Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- needed_money = float(input())
- owned_money = float(input())
- days_counter = 0
- spending_counter = 0
- while owned_money < needed_money and spending_counter < 5:
- command = input()
- money = float(input())
- days_counter += 1
- if command == 'Save':
- owned_money += money
- spending_counter = 0
- elif command == 'Spend':
- owned_money -= money
- spending_counter += 1
- if owned_money < 0:
- owned_money = 0
- if spending_counter == 5:
- print(f'You cannot save the money')
- print(f'{days_counter}')
- if owned_money >= needed_money:
- print(f"You saved the money for {days_counter} days.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement