Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # unPythonic
  2. if season == 'Winter':
  3. holiday = 'Christmas'
  4. elif season == 'Spring':
  5. holiday = 'Easter'
  6. elif season == 'Summer':
  7. holiday = 'American Independence Day'
  8. elif season == 'Fall':
  9. holiday = 'Halloween'
  10. else:
  11. holiday = 'Personal day off'
  12.  
  13. # Pythonic
  14. holiday = {'Winter': 'Christmas',
  15. 'Spring': 'Easter',
  16. 'Summer': 'American Independence Day',
  17. 'Fall': 'Halloween'}.get(season, 'Personal day off')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement