Advertisement
mark79

Clever Lily

Sep 11th, 2019
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. age = int(input())
  2. laundry_price = float(input())
  3. toy_price = int(input())
  4.  
  5. money = 0
  6. for i in range(1, age + 1):
  7.     money += i * 5 - 1 if i % 2 == 0 else toy_price
  8.     # if i % 2 == 0:
  9.     #     money += i * 5 - 1
  10.     # else:
  11.     #     money += toy_price
  12.  
  13. result = abs(money-laundry_price)
  14. if money < laundry_price:
  15.     print(f"No! {result:.2f}")
  16. else:
  17.     print(f"Yes! {result:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement