Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def foo1():
  2. print("foo1 running...")
  3. return 1
  4.  
  5. def foo2():
  6. print("foo2 running...")
  7. return 2
  8.  
  9. def foo3():
  10. print("foo3 running...")
  11. return 3
  12.  
  13. def default():
  14. print("default running...")
  15. return 0
  16.  
  17. option="case3"
  18.  
  19. result = {
  20. 'case1': foo1,
  21. 'case2': foo2,
  22. 'case3': foo3,
  23. 'default': default,
  24. }.get(option)()
  25.  
  26. print(result)
Add Comment
Please, Sign In to add comment