I have a variable I want to set depending on the values in three booleans. The most straight-forward way is an if statement followed by a series of elifs:
if a a
Here is a truth table approach:
lookup = {'000': 'eighth', '001': 'seventh', '010': 'sixth', '011': 'fifth', '100': 'fourth', '101': 'third', '110': 'second', '111': 'first'} def key(a, b, c): return ''.join([str(a),str(b),str(c)]) name = lookup[key(0,1,1)]