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