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
- while True:
- product = input()
- if product == "Stop":
- print(f'You bought {product_counter} products for {money_spent:.2f} leva.')
- break
- product_price = float(input())
- 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!')
- if (product_counter + 1) % 3 == 0:
- product_price *= 0.5
- product_counter += 1
- money_left -= product_price
- money_spent += product_price
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement