Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trip_money = float(input())
- real_money = float(input())
- saved_money = 0
- day_numb = 0
- spend_day = 0
- while saved_money < trip_money:
- command = input()
- sum_of_command = float(input())
- day_numb += 1
- if command == "spend":
- real_money -= sum_of_command
- if real_money < 0:
- real_money = 0
- spend_day += 1
- if command == "save":
- spend_day = 0
- real_money += sum_of_command
- if real_money >= trip_money:
- print(f"You saved the money for {day_numb} days.")
- break
- if spend_day == 5:
- print("You can't save the money.")
- print(spend_day)
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement