Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = float(input())
- overnight = int(input())
- overnight_price = float(input())
- additional_costs = float(input())
- if overnight > 7:
- overnight_price *= 0.95
- total_price = overnight * overnight_price + additional_costs * budget / 100
- if total_price <= budget:
- print(f"Ivanovi will be left with {budget - total_price:.2f} leva after vacation.")
- else:
- print(f"{total_price - budget:.2f} leva needed.")
- Решение с тернарен оператор:
- budget = float(input())
- overnight = int(input())
- overnight_price = float(input())
- additional_costs = float(input())
- total_price = overnight * overnight_price * (0.95 if overnight > 7 else 1) + additional_costs * budget / 100
- diff = abs(total_price - budget)
- print(f"Ivanovi will be left with {diff:.2f} leva after vacation." if total_price <= budget else f"{diff:.2f} leva needed.")
- Тарикатско решение:)
- budget = float(input())
- overnight = int(input())
- budget -= overnight * float(input()) * (0.95 if overnight > 7 else 1) + float(input()) * budget / 100
- print(f"Ivanovi will be left with {budget:.2f} leva after vacation." if budget >= 0 else f"{abs(budget):.2f} leva needed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement