Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = float(input())
- fuel = float(input())
- day = input()
- total = fuel * 2.1 + 100
- if day == "Saturday":
- total *= 0.9
- else:
- total *= 0.8
- if budget >= total:
- print(f"Safari time! Money left: {budget - total:.2f} lv. ")
- else:
- print(f"Not enough money! Money needed: {total - budget:.2f} lv.")
- Решение с тернарен оператор:
- budget = float(input())
- fuel = float(input())
- day = input()
- total = (fuel * 2.1 + 100) * (0.9 if day == "Saturday" else 0.8)
- print(f"Safari time! Money left: {budget - total:.2f} lv. " if budget >= total
- else f"Not enough money! Money needed: {total - budget:.2f} lv.")
- Тарикатско решение:)
- total = float(input()) - ((float(input()) * 2.1 + 100) * (0.9 if input() == "Saturday" else 0.8))
- print(f"Safari time! Money left: {total:.2f} lv. " if total >= 0 else f"Not enough money! Money needed: {abs(total):.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement