Advertisement
Spocoman

01. Computer Store

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