Advertisement
simeonshopov

Clever Lily

Oct 15th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. age = int(input())
  2. washer = float(input())
  3. toy_price = int(input())
  4. toys = 0
  5. money = 0
  6. total = 0
  7. even_years = 0
  8.  
  9. for i in range(1, age + 1):
  10.   if i % 2 == 0:
  11.     money += 10 * (i / 2)
  12.     even_years += 1
  13.   else:
  14.     toys += 1
  15.    
  16. total = (money - even_years) + toys * toy_price
  17. if total >= washer:
  18.   print(f"Yes! {(total - washer):.2f}")
  19.  
  20. else:
  21.   print(f"No! {abs(total - washer):.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement