Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # unPythonic
- if season == 'Winter':
- holiday = 'Christmas'
- elif season == 'Spring':
- holiday = 'Easter'
- elif season == 'Summer':
- holiday = 'American Independence Day'
- elif season == 'Fall':
- holiday = 'Halloween'
- else:
- holiday = 'Personal day off'
- # Pythonic
- holiday = {'Winter': 'Christmas',
- 'Spring': 'Easter',
- 'Summer': 'American Independence Day',
- 'Fall': 'Halloween'}.get(season, 'Personal day off')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement