I have made a program to calculate the amount of flour, eggs, sugar and butter required for making lemon cakes and cupcakes.
import math
cupcake = [4, 0.1, 12, 14]
#[Butter, egg, flour, sugar]
lemon = [80, 4.5, 240, 300]
#[Butter, egg, flour, sugar]
cup_in = int(input('How many cupcakes would you like? '))
lem_in = int(input('How much lemon cake would you like? '))
amount_cup = []
amount_cup = [x*cup_in for x in cupcake]
amount_lemon = []
amount_lemon = [(x * lem_in) for x in lemon]
print(amount_cup)
print(amount_lemon)
total = []
total = [x + y for x, y in zip(amount_cup, amount_lemon)]
print(total)
amt_butter = total[0]
amt_egg = total[1]
amt_flour = total[2]
amt_sugar = total[3]
bag_but_large = 0
bag_but_medium = 0
bag_but_small = 0
bag_flr_large = 0
bag_flr_medium = 0
bag_flr_small = 0
bag_egg_large = 0
bag_egg_medium = 0
bag_egg_small = 0
bag_sgr_large = 0
bag_sgr_medium = 0
bag_sgr_small = 0
#Calculates the amount of butter bags needed
while amt_butter > 0:
if amt_butter > 500:
amt_butter -= 500
bag_but_large += 1
elif amt_butter > 250:
amt_butter -= 250
bag_but_medium += 1
elif amt_butter > 125:
amt_butter -= 125
bag_but_small += 1
else:
bag_but_small += 1
amt_butter = 0
#Flour
while amt_flour > 0:
if amt_flour > 750:
amt_flour -= 750
bag_flr_large += 1
elif amt_flour > 500:
amt_flour -= 500
bag_flr_medium += 1
elif amt_flour > 250:
amt_flour -= 250
bag_flr_small += 1
else:
bag_flr_small += 1
amt_flour = 0
#Egg
while amt_egg > 0:
if amt_egg > 12:
amt_egg -= 12
bag_egg_large += 1
elif amt_egg > 10:
amt_egg -= 10
bag_egg_medium += 1
elif amt_egg > 6:
amt_egg -= 6
bag_egg_small += 1
else:
bag_egg_small += 1
amt_egg = 0
#Sugar
while amt_sugar > 0:
if amt_sugar > 600:
amt_sugar -= 600
bag_sgr_large += 1
elif amt_sugar > 400:
amt_sugar -= 400
bag_sgr_medium += 1
elif amt_sugar > 200:
amt_sugar -= 200
bag_sgr_small += 1
else:
bag_sgr_small += 1
amt_sugar = 0
print("*" * 80)
print("Purchases needed: ")
print(bag_but_large, "large bags of butter needed.")
print(bag_but_medium, "medium bags of butter needed.")
print(bag_but_small, "small bags of butter needed.")
print("*" * 80)
print(bag_flr_large, "large bags of flour needed.")
print(bag_flr_medium, "medium bags of flour needed.")
print(bag_flr_small, "small bags of flour needed.")
print("*" * 80)
print(bag_sgr_large, "large bags of sugar needed.")
print(bag_sgr_medium, "medium bags of sugar needed.")
print(bag_sgr_small, "small bags of sugar needed.")
print("*" * 80)
print(bag_egg_large, "large boxes of eggs needed.")
print(bag_egg_medium, "medium boxes of eggs needed.")
print(bag_egg_small, "small boxes of eggs needed.")