Advertisement
bl00dt3ars

09. Easter Cozonacs

May 21st, 2021
94
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. flour_price = float(input())
  3. eggs_price = flour_price * 0.75
  4. milk_price = flour_price * 1.25 / 4
  5. price_for_one_cozonac = flour_price + eggs_price + milk_price
  6.  
  7. cozonacs = 0
  8. colored_eggs = 0
  9.  
  10. while budget >= price_for_one_cozonac:
  11.     cozonacs += 1
  12.     colored_eggs += 3
  13.     if cozonacs % 3 == 0:
  14.         colored_eggs -= (cozonacs - 2)
  15.  
  16.     budget -= price_for_one_cozonac
  17.  
  18. print(f"You made {cozonacs} cozonacs! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement