Sichanov

tourist shop

Apr 13th, 2021
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. budget = float(input())
  2. total = 0
  3. command = input()
  4. counter = 0
  5. while command != 'Stop':
  6.     name_of_product = command
  7.     price = float(input())
  8.     total += price
  9.     counter += 1
  10.     if counter % 3 == 0:
  11.         total -= price / 2
  12.     if budget < total:
  13.         print("You don't have enough money!")
  14.         print(f"You need {total - budget:.2f} leva!")
  15.         break
  16.     command = input()
  17. if command == 'Stop':
  18.     print(f"You bought {counter} products for {total:.2f} leva.")
  19.  
Advertisement
Add Comment
Please, Sign In to add comment