BbJLeB

08. Clever Lily

May 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. # 08. Clever Lily
  2.  
  3. age = int(input())
  4. washing_mashine_price = float(input())
  5. toy_price = int(input())
  6.  
  7. count_toys = 0
  8. amount = 10
  9. money = 0
  10. for year in range(1, age+1):
  11.     if not year % 2 ==0:
  12.         count_toys += 1
  13.     else:
  14.         money += amount - 1
  15.         amount += 10
  16. money += count_toys * toy_price
  17. diff = abs(money - washing_mashine_price)
  18. if money >= washing_mashine_price:
  19.     print(f"Yes! {diff:.2f}")
  20. else:
  21.     print(f"No! {diff:.2f}")
Add Comment
Please, Sign In to add comment