Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- people = int(input())
- season = input()
- price = 0
- if season == 'spring':
- if people <= 5:
- price = 50
- else:
- price = 48
- elif season == 'summer':
- if people <= 5:
- price = 48.50
- else:
- price = 45
- elif season == 'autumn':
- if people <= 5:
- price = 60
- else:
- price = 49.50
- elif season == 'winter':
- if people <= 5:
- price = 86
- else:
- price = 85
- if season == 'summer':
- price *= 0.85
- elif season == 'winter':
- price *= 1.08
- sums = price * people
- print(f'{sums:.2f} leva.')
- РЕШЕНИЕ С IF И ТЕРНАРЕН ОПЕРАТОР:
- people = int(input())
- season = input()
- price = 0
- if season == 'spring':
- price = 50 if people <= 5 else 48
- elif season == 'summer':
- price = 48.50 if people <= 5 else 45
- elif season == 'autumn':
- price = 60 if people <= 5 else 49.50
- elif season == 'winter':
- price = 86 if people <= 5 else 85
- price *= 0.85 if season == 'summer' else 1.08 if season == 'winter' else 1
- sums = price * people
- print(f'{sums:.2f} leva.')
- РЕШЕНИЕ САМО С ТЕРНАРЕН ОПЕРАТОР:
- people = int(input())
- season = input()
- sums = (((50 if people <= 5 else 48) if season == 'spring' else
- (48.50 if people <= 5 else 45) if season == 'summer' else
- (60 if people <= 5 else 49.50) if season == 'autumn' else
- (86 if people <= 5 else 85) if season == 'winter' else 0)
- * ((0.85 if season == 'summer' else 1.08 if season == 'winter' else 1) * people))
- print(f"{sums:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement