SHARE
TWEET

Untitled

a guest Jun 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top