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