Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2020
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. trip_money = float(input())
  2. avaliable_money = float(input())
  3. days = 0
  4.  
  5. while True:
  6.     transaction = input()
  7.     money_sum = float(input())
  8.  
  9.     days += 1
  10.  
  11.     if transaction == "spend" and days < 5:
  12.         if avaliable_money <= money_sum:
  13.             avaliable_money = 0
  14.         else:
  15.             avaliable_money -= money_sum
  16.     elif transaction == "spend" and days >= 5:
  17.         print(f"You can't save the money.")
  18.         print(f'{days}')
  19.         break
  20.  
  21.     if transaction == "save":
  22.         avaliable_money += money_sum
  23.  
  24.     if avaliable_money >= trip_money:
  25.         print(f'You saved the money for {days} days.')
  26.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement