Advertisement
vasil_k_k

01. Computer Store

Feb 13th, 2023
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. net_price, taxes = [0, 0]
  2.  
  3. while True:
  4.     command = input()
  5.     if command in ["special", "regular"]:
  6.         break
  7.     if float(command) < 0:
  8.         print("Invalid price!")
  9.         continue
  10.     net_price += float(command)
  11.     taxes += float(command) * 20 / 100
  12.  
  13. total_price = net_price + taxes
  14.  
  15. if command == "special":
  16.     total_price *= 0.9
  17.  
  18. if net_price != 0:
  19.     print(f"Congratulations you've just bought a new computer!\nPrice without taxes: {net_price:.2f}$")
  20.     print(f"Taxes: {taxes:.2f}$\n-----------\nTotal price: {total_price:.2f}$")
  21. else:
  22.     print("Invalid order!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement