nanagabynka

Untitled

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