I am new to programming and I have this assignment with a recipe. The recipe is supposed to change the ingredients based on the amount of people.
recipeList = [["Egg",3,"st"], #list of the ingredients
["Sugar",3,"dl"], #with 4 people as base
["Vanilla sugar",2,"tsp"],
["Baking powder",2,"tsp"],
["Flour",3,"dl"],
["Butter",75,"g"],
["Water",1,"dl"]]
print("How many people are going to eat the cake?")
x = int(input())#input for user
print("Recipe for a sponge cake for", x, "people")
print("| Ingredients | Amount") #a list for ingredients and amount
for item in recipeList:
print("|",item[0]," "*(13-len(item[0])),"|", #visual design for the list
(item[1]*x/4), #amount * x/4, as recipe is based on 4 people
item[2]," "*(3-len(item[2])-len(str(item[1]))),
)
My question is, with this code and type of list, is it possible for me to print the amount of eggs as an integer? I do not want decimals on the egg-print. The assignment is okay with a 0 as result on egg