Rayapapaya

Untitled

Aug 20th, 2020
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. budget = float(input())
  2.  
  3. products = 0
  4. total_price = 0
  5.  
  6. while True:
  7. product = input()
  8. if product == "Stop":
  9. print(f"You bought {products} products for {total_price:.2f} leva.")
  10. break
  11. product_price = float(input())
  12. if product_price > budget:
  13. print("You don't have enough money!")
  14. print(f"You need {product_price - budget:.2f} leva!")
  15. break
  16. products += 1
  17. if products % 3 == 0:
  18. product_price /= 2
  19. budget -= product_price
  20. total_price += product_price
Advertisement
Add Comment
Please, Sign In to add comment