Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- total_price_without_taxes = 0
- while True:
- command = input()
- if command == "special" or command == "regular":
- break
- current_price = float(command)
- if current_price < 0:
- print("Invalid price!")
- else:
- total_price_without_taxes += current_price
- taxes = total_price_without_taxes * 0.2
- final_price = total_price_without_taxes + taxes
- special_final_price = (total_price_without_taxes + taxes) * 0.9
- if total_price_without_taxes == 0:
- print("Invalid order!")
- else:
- if command == "regular":
- print("Congratulations you've just bought a new computer!")
- print(f"Price without taxes: {total_price_without_taxes:.2f}$")
- print(f"Taxes: {taxes:.2f}$")
- print("-----------")
- print(f"Total price: {final_price:.2f}$")
- else:
- print("Congratulations you've just bought a new computer!")
- print(f"Price without taxes: {total_price_without_taxes:.2f}$")
- print(f"Taxes: {taxes:.2f}$")
- print("-----------")
- print(f"Total price: {special_final_price:.2f}$")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement