Advertisement
BbJLeB

04. Food Order

May 23rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. # 04. Food Order
  2.  
  3. budget = float(input())
  4. tot_price = 2.50
  5. price = 0
  6. product_counter = 0
  7. product = input()
  8. while product != "Order":
  9.     price = float(input())
  10.     product_counter += 1
  11.     tot_price += price
  12.     if tot_price > budget:
  13.         print(f"You will exceed the budget if you order this!")
  14.         tot_price -= price
  15.         product_counter -= 1
  16.     product = input()
  17.  
  18.  
  19. print(f"You ordered {product_counter} items!\nTotal: {tot_price:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement