Advertisement
Guest User

clever_lily

a guest
Feb 8th, 2020
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. age = int(input())
  2. laundry_price = float(input())
  3. toy_price = int(input())
  4.  
  5. toys_count = 0
  6. money = 0
  7. brother = 0
  8. even_birthdays = 0
  9.  
  10. for year in range(1, age + 1):
  11.     if year % 2 != 0:
  12.         toys_count += 1
  13.     else:
  14.         even_birthdays += 1
  15.         brother += 1
  16.         if year != 2:
  17.             money += 10 * even_birthdays
  18.         else:
  19.             money += 10
  20.  
  21. savings = toys_count * toy_price + money - brother
  22. diff = abs(savings - laundry_price)
  23.  
  24. if savings >= laundry_price:
  25.     print(f'Yes! {diff:.2f}')
  26. else:
  27.     print(f'No! {diff:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement