Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- age = int(input())
- price_laundry = float(input())
- price_per_toy = int(input())
- # парите на Лили = играчки(бр. играчки * цена за 1 играчка) + спестени пари
- count_toys = 0
- saved_money = 0
- # за всеки рожден ден от [1 до възрастта] -> проверяваме какво е получила
- for birthday in range(1, age + 1):
- if birthday % 2 == 1:
- count_toys += 1
- else:
- saved_money += birthday * 5 - 1
- # броят на играчките
- # спестени пари
- #парите на Лили
- total_money = saved_money + (count_toys * price_per_toy)
- if total_money >= price_laundry:
- left_money = total_money - price_laundry
- print(f"Yes! {left_money:.2f}")
- else:
- need_money = price_laundry - total_money
- print(f"No! {need_money:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement