Advertisement
eNeRGy90

Untitled

Nov 4th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. vacation_money = float(input())
  2. savings = float(input())
  3.  
  4.  
  5. days_count = 0
  6. spend_count = 0
  7.  
  8. while vacation_money > savings:
  9. command = input()
  10. money = float(input())
  11.  
  12. if command == "spend":
  13. spend_count += 1
  14. savings -= money
  15. if savings < 0:
  16. savings = 0
  17.  
  18. elif command == "save":
  19. savings += money
  20. spend_count = 0
  21. days_count += 1
  22. if spend_count == 5:
  23. break
  24.  
  25. if vacation_money <= savings:
  26. print(f"You saved the money for {days_count} days.")
  27. else:
  28. print(f"You can't save the money.")
  29. print(f"{days_count}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement