Advertisement
Nenogzar

computer store

Feb 18th, 2024
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. total_sum = 0
  2. data = input()
  3.  
  4.  
  5. special = 1
  6.  
  7.  
  8. while data != "special" and data != "regular":
  9.     price = float(data)
  10.  
  11.     if price > 0:
  12.         total_sum += price
  13.     else:
  14.         print("Invalid price!")
  15.  
  16.     data = input()
  17.  
  18. taxes = total_sum * 0.2
  19.  
  20. if data == "special":
  21.     special = 0.9
  22.  
  23. if total_sum == 0:
  24.     print("Invalid order!")
  25.  
  26. else:
  27.     print("Congratulations you've just bought a new computer!")
  28.     print(f"Price without taxes: {total_sum:.2f}$")
  29.     print(f"Taxes: {taxes:.2f}$")
  30.     print("-----------")
  31.     print(f"Total price: {(total_sum + taxes) * special:.2f}$")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement