Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- km = int(input())
- time = input()
- price = 0
- if km < 20:
- if time == "day":
- price = km * 0.79 + 0.7
- else:
- price = km * 0.9 + 0.7
- elif km >= 100:
- price = km * 0.06
- else:
- price = km * 0.09
- print(f"{price:.2f}")
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- km = int(input())
- time = input()
- price = km * (0.79 if time == "day" else 0.9) + 0.7 if km < 20 else km * 0.06 if km >= 100 else km * 0.09
- print(f"{price:.2f}")
- Или леко тарикатската:
- km = int(input())
- print(f'{(km * (0.79 if input() == "day" else 0.9) + 0.7 if km < 20 else km * 0.06 if km >= 100 else km * 0.09):.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement