Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- month = input()
- hours = int(input())
- people = int(input())
- time = input()
- price = 0
- if month in ("march", "april", "may"):
- if time == "day":
- price = 10.5
- hours = 3
- else:
- price = 8.4
- elif month in ("june", "july", "august"):
- if time == "day":
- price = 12.6
- else:
- price = 10.2
- if people >= 4:
- price *= 0.9
- if hours >= 5:
- price /= 2
- total = price * people * hours
- print(f"Price per person for one hour: {price:.2f}")
- print(f"Total cost of the visit: {total:.2f}")
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- month = input()
- hours = int(input())
- people = int(input())
- time = input()
- price = (10.5 if time == "day" else 8.4) if month in ("march", "april", "may") else \
- (12.6 if time == "day" else 10.2) if month in ("june", "july", "august") else 0
- hours = 3 if month in ("march", "april", "may") and time == "day" else hours
- price *= 0.9 if people >= 4 else 1
- price /= 2 if hours >= 5 else 1
- total = price * people * hours
- print(f"Price per person for one hour: {price:.2f}\n"
- f"Total cost of the visit: {total:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement