sibinasto

PF - Basic Syntax - 09. Easter Cozonacs - Exercise

Jan 15th, 2021
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. budget = float(input())
  2. price_flour = float(input())
  3.  
  4. price_eggs = price_flour * 0.75
  5. price_milk_1l = price_flour * 1.25
  6.  
  7. cozonac_price = price_flour + price_eggs + 0.25 * price_milk_1l
  8. cozonacs_count = 0
  9. colored_eggs_count = 0
  10. while budget > cozonac_price:
  11.     budget -= cozonac_price
  12.     cozonacs_count += 1
  13.     colored_eggs_count += 3
  14.     if cozonacs_count % 3 == 0:
  15.         lost_eggs = cozonacs_count - 2
  16.         colored_eggs_count -= lost_eggs
  17.  
  18. print(f"You made {cozonacs_count} cozonacs! Now you have {colored_eggs_count} eggs and {budget:0.2f}BGN left.")
Advertisement
Add Comment
Please, Sign In to add comment