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