Advertisement
BbJLeB

04. Food Order

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