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