Advertisement
GalinaKG

01. Computer Store

Jun 3rd, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. command = input()
  2. total_sum = 0
  3. condition = False
  4.  
  5. while command != 'special':
  6.     if command == 'regular':
  7.         break
  8.     numbers = float(command)
  9.  
  10.     if numbers < 0:
  11.         print('Invalid price!')
  12.         command = input()
  13.         continue
  14.  
  15.     total_sum += numbers
  16.  
  17.     if total_sum == 0:
  18.         print('Invalid order!')
  19.  
  20.     command = input()
  21.  
  22. total_amount_of_taxes = total_sum * 0.20
  23. total_sum_with_taxes = total_sum + total_amount_of_taxes
  24.  
  25. if command == 'special':
  26.     total_sum_with_taxes -= (total_sum_with_taxes * 0.10)
  27.  
  28. if total_sum_with_taxes == 0:
  29.     print('Invalid order!')
  30. else:
  31.     print(f"Congratulations you've just bought a new computer!\nPrice without taxes: {total_sum:.2f}$\nTaxes:"
  32.           f" {total_amount_of_taxes:.2f}$\n-----------\nTotal price: {total_sum_with_taxes:.2f}$")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement