Advertisement
Nenogzar

Untitled

Jan 17th, 2024
1,022
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. budget = float(input())
  2. price_of_kg_flour = float(input())
  3.  
  4. eggs_pack = price_of_kg_flour * 0.75
  5. milk_one_l = (price_of_kg_flour * 1.25) / 4
  6. colored_eggs = 0
  7. for number_breads in range(1, int(budget) + 1):
  8.     if eggs_pack + milk_one_l + price_of_kg_flour <= budget:
  9.         budget -= (eggs_pack + milk_one_l + price_of_kg_flour)
  10.         colored_eggs += 3
  11.         if number_breads % 3 == 0:
  12.             colored_eggs -= (number_breads - 2)
  13.     else:
  14.         print(
  15.             f"You made {number_breads - 1} loaves of Easter bread! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.")
  16.         break
Tags: Easter Bread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement