nanagabynka

Untitled

May 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. budget = float(input())
  2. price_tot = 0
  3. product_counter = 0
  4.  
  5. while price_tot <= budget:
  6.     price_name = input()
  7.     if price_name == "Stop":
  8.         print(f"You bought {product_counter} products for {price_tot:.2f} leva.")
  9.         break
  10.     price_product = float(input())
  11.     product_counter += 1
  12.     if product_counter % 3 == 0:
  13.         price_product -= price_product * 0.50
  14.     price_tot += price_product
  15. else:
  16.     print(f"You don't have enough money!\nYou need {(price_tot - budget):.2f} leva!")
Advertisement
Add Comment
Please, Sign In to add comment