Advertisement
Spocoman

09. Easter Bread

Jan 14th, 2022 (edited)
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. budget = float(input())
  2. flour_kg = float(input())
  3.  
  4. easter_bread = 0
  5. colored_eggs = 0
  6. easter_bread_price = flour_kg * 1.75 + flour_kg * 1.25 / 4
  7.  
  8. while budget >= easter_bread_price:
  9.     budget -= easter_bread_price
  10.     colored_eggs += 3
  11.     easter_bread += 1
  12.     if easter_bread % 3 == 0:
  13.         colored_eggs -= easter_bread - 2
  14.  
  15. print(f"You made {easter_bread} loaves of Easter bread! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.")
  16.  
  17. Или леко тарикатската:)
  18.  
  19. budget = float(input())
  20. easter_bread_price = float(input()) * 2.0625
  21.  
  22. easter_bread = 0
  23. colored_eggs = 0
  24.  
  25. while budget >= easter_bread_price:
  26.     budget -= easter_bread_price
  27.     colored_eggs += 3
  28.     easter_bread += 1
  29.     if easter_bread % 3 == 0:
  30.         colored_eggs -= easter_bread - 2
  31.  
  32. print(f"You made {easter_bread} loaves of Easter bread! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.")
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement