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