original_version = """
if x == 'a' and y == 'b' or x == 'b' and y == 'a':
    z = 'c'
elif x == 'b' and y == 'c' or x == 'c' and y == 'b':
    z = 'a'
elif x == 'a' and y == 'c' or x == 'c' and y == 'a':
    z = 'b'
"""
for x, y in itertools.product('abc', repeat=2):
    print('\nTesting with x=%r and y=%r' % (x, y))
setup = setup_template % (x, y)
for stmt, name in zip([original_version, new_version], ['if', 'set']):
    print(min(timeit.Timer(stmt, setup).repeat(7, 100000)), end=' ')
print('\t%s_version' % name)
How can I find the missing value more concisely?