Advertisement
BdW44222

01. Computer Store

Jul 7th, 2021
1,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. prices = input()
  2. total_price = 0
  3.  
  4. while not (prices == "special" or prices == "regular"):
  5.     current_price = float(prices)
  6.     if current_price <= 0:
  7.         print("Invalid price!")
  8.     else:
  9.         total_price += current_price
  10.     prices = input()
  11.  
  12. if total_price == 0:
  13.     print("Invalid order!")
  14. else:
  15.     print("Congratulations you've just bought a new computer!")
  16.     print(f"Price without taxes: {total_price:.2f}$")
  17.     taxes = total_price * 0.2
  18.     print(f"Taxes: {taxes:.2f}$")
  19.     print("-----------")
  20.     total = total_price + taxes
  21.     if prices == "special":
  22.         total -= total * 0.1
  23.     print(f"Total price: {total:.2f}$")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement