Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = float(input())
- command = ""
- product_name = ""
- product_price = 0
- numb_of_item = 0
- all_price = 0
- all_numb = 0
- while command != "Stop":
- product_name = input()
- if product_name == "Stop":
- break
- else:
- pass
- product_price = float(input())
- numb_of_item += 1
- if numb_of_item == 3:
- 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()
- all_numb += 1
- command = product_name
- print(f"You bought {all_numb} products for {all_price:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement