Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- night = int(input()) - 1
- room = input()
- rating = input()
- total = 0
- if room == "room for one person":
- total = night * 18
- elif room == "apartment":
- total = night * 25
- if night < 10:
- total *= 0.7
- elif 10 <= night < 15:
- total *= 0.65
- else:
- total *= 0.5
- elif room == "president apartment":
- total = night * 35
- if night < 10:
- total *= 0.9
- elif 10 <= night < 15:
- total *= 0.85
- else:
- total *= 0.8
- if rating == "positive":
- total *= 1.25
- else:
- total *= 0.9
- print(f'{total:.2f}')
- РЕШЕНИЕ С IF-ELSE И ТЕРНАРЕН ОПЕРАТОР:
- night = int(input()) - 1
- room = input()
- rating = input()
- total = 0
- if room == "room for one person":
- total = night * 18
- elif room == "apartment":
- total = night * 25 * (0.7 if night < 10 else 0.65 if 10 <= night < 15 else 0.5)
- elif room == "president apartment":
- total = night * 35 * (0.9 if night < 10 else 0.85 if 10 <= night < 15 else 0.8)
- total *= 1.25 if rating == "positive" else 0.9
- print(f'{total:.2f}')
- РЕШЕНИЕ САМО С ТЕРНАРЕН ОПЕРАТОР:
- night = int(input()) - 1
- room = input()
- rating = input()
- total = night * (18 if room == "room for one person" else
- 25 * (0.7 if night < 10 else 0.65 if 10 <= night < 15 else 0.5) if room == "apartment" else
- 35 * (0.9 if night < 10 else 0.85 if 10 <= night < 15 else 0.8)) * (1.25 if rating == "positive" else 0.9)
- print(f'{total:.2f}')
- PЕШЕНИЕ С КОЛЕКЦИЯ И ТЕРНАРЕН ОПЕРАТОР:
- night = int(input()) - 1
- room = input()
- rating = input()
- total = night * {"room for one person": {night > 0: 18},
- "apartment": {night < 10: 25 * 0.7, 10 <= night < 15: 25 * 0.65, night >= 15: 25 / 2},
- "president apartment": {night < 10: 35 * 0.9, 10 <= night < 15: 35 * 0.85, night >= 15: 35 * 0.8}}[room][True]
- total *= 1.25 if rating == "positive" else 0.9
- print(f'{total:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement