Advertisement
Maxim_01

Untitled

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