Advertisement
bl00dt3ars

01. Computer Store

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