Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- age = int(input())
- washing_machine_price = float(input())
- toy_price = int(input())
- saved_money = 0
- money_per_birthday = 0
- for year in range(1, age + 1):
- if year % 2 != 0:
- saved_money += toy_price
- elif year % 2 == 0 and year == 2:
- money_per_birthday = 10
- saved_money += money_per_birthday
- elif year % 2 == 0 and year != 2:
- money_per_birthday += 10
- saved_money += money_per_birthday
- # Money for brother
- saved_money -= (age // 2)
- diff = abs(saved_money - washing_machine_price)
- if saved_money >= washing_machine_price:
- print(f'Yes! {diff:.2f}')
- else:
- print(f'No! {diff:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment