Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- needed_money = float(input())
- init_money = float(input())
- count_spend_days = 0
- all_days_count = 0
- while init_money < needed_money:
- if count_spend_days == 5:
- break
- action = input()
- amount = float(input())
- all_days_count += 1
- if action == "spend":
- count_spend_days += 1
- init_money -= amount
- if init_money < 0:
- init_money = 0
- elif action == "save":
- count_spend_days = 0
- init_money += amount
- if count_spend_days == 5:
- print("You can't save the money.")
- print(all_days_count)
- else:
- print(f"You saved the money for {all_days_count} days.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement