Advertisement
veronikaaa86

04. Clever Lily

May 29th, 2022
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. age = int(input())
  2. price_wash_machine = float(input())
  3. toy_price = int(input())
  4.  
  5. money = 10
  6. count_toys = 0
  7. sum = 0
  8. brother_count = 0
  9. for i in range(1, age + 1):
  10. if i % 2 != 0:
  11. count_toys += 1
  12. else:
  13. brother_count += 1
  14. sum = sum + money
  15. money = money + 10
  16.  
  17. result = sum + (count_toys * toy_price) - brother_count
  18.  
  19. diff = abs(result - price_wash_machine)
  20. if result >= price_wash_machine:
  21. print(f"Yes! {diff:.2f}")
  22. else:
  23. print(f"No! {diff:.2f}")
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement