Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- age = int(input())
- drink = ''
- if age <= 14:
- drink = 'toddy'
- elif age <= 18:
- drink = 'coke'
- elif age <= 21:
- drink = 'beer'
- elif age > 21:
- drink = 'whisky'
- print(f'drink {drink}')
- Решение с колекция:
- age = int(input())
- drink = {age <= 14: 'toddy', 14 < age <= 18: 'coke', 18 < age <= 21: 'beer', age > 21: 'whisky'}
- print(f'drink {drink[True]}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement