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