sievrebo

Clever Lily

May 19th, 2019
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. age_Lilly = int(input())
  2. price_washing_machine = float(input())
  3. price_toy = int(input())
  4.  
  5. toys_count = 0
  6. money_sum = 0
  7. total_sum = 0
  8.  
  9. for years in range(1, age_Lilly + 1):
  10.  
  11.     if years % 2 == 1:
  12.         toys_count += 1
  13.     else:
  14.         money_sum += years * 5 - 1
  15.  
  16. total_sum = toys_count * price_toy + money_sum
  17. differance = abs(total_sum - price_washing_machine)
  18. if total_sum >= price_washing_machine:
  19.  
  20.     print(f"Yes! {differance:.2f}")
  21. else:
  22.     print(f"No! {differance:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment