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