RosettaCodeData/Task/Conditional-structures/Python/conditional-structures-7.py

8 lines
163 B
Python

# Or without the temp variable
# (it's up to the reader to decide how "pythonic" this is or isn't)
results = {
0: foo,
1: bar,
2: baz,
}.get(x, boz)()