aneliabogeva

Vacation

May 13th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. money_needed = float(input())
  2. current_money = float(input())
  3.  
  4. counter_save = 0
  5. counter_spend = 0
  6. days_counter = 0
  7.  
  8. while current_money < money_needed:
  9. operation = input()
  10. amount = float(input())
  11. if operation == 'spend':
  12. current_money = current_money - amount
  13. if current_money < 0:
  14. current_money = 0
  15. counter_spend += 1
  16. days_counter += 1
  17. if counter_spend >= 5:
  18. print(f"You can't save the money.")
  19. print(days_counter)
  20. break
  21. else:
  22. current_money += amount
  23. counter_spend = 0
  24. days_counter += 1
  25. if current_money >= money_needed:
  26. print(f"You saved the money for {days_counter} days.")
Advertisement
Add Comment
Please, Sign In to add comment