RosettaCodeData/Task/Conditional-structures/Python/conditional-structures-7.py
2023-07-01 13:44:08 -04:00

7 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)()