svephoto

Easter Bread [Python]

Sep 23rd, 2021
868
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. budget = float(input())
  2. flour_price = float(input())
  3.  
  4. pack_of_eggs_price = flour_price * 0.75
  5. liter_of_milk_price = flour_price * 1.25
  6.  
  7. bread_price = flour_price + pack_of_eggs_price + liter_of_milk_price * 0.25
  8.  
  9. loaves = 0
  10. colored_eggs = 0
  11. # remaining_sum = 0
  12.  
  13. while budget >= bread_price:
  14.     loaves += 1
  15. #   remaining_sum = budget - bread_price
  16.     budget -= bread_price
  17.     colored_eggs += 3
  18.     if loaves % 3 == 0:
  19.         colored_eggs -= (loaves - 2)
  20.  
  21. print(f'You made {loaves} loaves of Easter bread! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.')
RAW Paste Data