Advertisement
AntonStanoev

Untitled

Dec 18th, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import math
  2.  
  3. name = input()
  4. budget = float(input())
  5. bottles_beer = int(input())
  6. paquets_chips = int(input())
  7.  
  8. price_beer = bottles_beer * 1.20
  9. percentage = price_beer * 0.45
  10. price_chips = math.ceil(paquets_chips * percentage)
  11.  
  12. total_price = price_beer + price_chips
  13.  
  14. if total_price <= budget:
  15.     print(f"{name} bought a snack and has {budget - total_price:.2f} leva left.")
  16. else:
  17.     print(f"{name} needs {total_price - budget:.2f} more leva!")
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement