Advertisement
here2share

# switchlike.py

Aug 16th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. # switchlike.py
  2.  
  3. def switchOne():
  4.     print 'first'
  5. def switchTwo():
  6.     print 'second'
  7. def switchThr():
  8.     print 'third'
  9.  
  10. for z in '32121132':
  11.     eval({1:'switchOne()',2:'switchTwo()',3:'switchThr()'}[int(z)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement