Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. budget = float(input())
  2. counter = 0
  3. given_money = 0
  4. price = 0
  5. while True:
  6. product_name = input()
  7. if product_name == "Stop":
  8. print(f"You bought {counter} products for {given_money:.2f} leva.")
  9. break
  10. price = float(input())
  11. if price > budget:
  12. print(f"You don't have enough money!")
  13. print(f"You need {price - budget:.2f} leva!")
  14. break
  15. counter += 1
  16. if counter // 3 == 1:
  17. price = price * 0.50
  18. given_money += price
  19. budget -= price
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement