Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = float(input())
- budget_1 = budget
- product_counter = 0
- product_price = 0
- while budget_1 > 0:
- text = input()
- if text == 'Stop':
- print(f"You bought {product_counter} products for {product_price:.2f} leva.")
- break
- else:
- price = float(input())
- if price > budget_1:
- needed = price - budget_1
- print("You don't have enough money!")
- print(f"You need {needed:.2f} leva!")
- break
- else:
- product_counter += 1
- if product_counter % 3 == 0:
- price /= 2
- product_price += price
- budget_1 -= price
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement