Advertisement
simeonshopov

Trip Expenses (late july exam)

Nov 6th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. days = int(input())
  2. money_left = 0
  3. found = False
  4.  
  5. for i in range(days):
  6.   balance = 60 + money_left
  7.   products = 0
  8.   price = input()
  9.   while price != "Day over":
  10.     if int(price) <= balance:
  11.       balance -= int(price)
  12.       products += 1
  13.     money_left = balance
  14.     if balance == 0:
  15.       print(f"Daily limit exceeded! You've bought {products} products.")
  16.       break
  17.     price = input()
  18.   else:
  19.     money_left = balance
  20.     print(f"Money left from today: {balance:.2f}. You've bought {products} products.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement