Teo_Yanchev

tourist_shop_2-3-2019_exam

Jul 15th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. budget = float(input())
  2.  
  3. count_product = 0
  4. total_price = 0
  5. command = input()
  6. while command != "Stop":
  7. name_product = command
  8. price_product = float(input())
  9. count_product += 1
  10.  
  11. if count_product % 3 == 0:
  12. price_product *= 0.50
  13.  
  14. total_price += price_product
  15. if budget < total_price:
  16. diff = abs(budget - total_price)
  17. print(f"You don't have enough money!")
  18. print(f"You need {diff:.2f} leva!")
  19. break
  20. command = input()
  21. else:
  22. print(f"You bought {count_product} products for {total_price:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment