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