ingredients management system python

Solutions on MaxInterview for ingredients management system python by the best coders in the world

showing results for - "ingredients management system python"
Nicola
28 Nov 2020
1def ingredients(recipes,menu):
2    storage = []
3    empty_lst =[]
4    inner = []
5    count = 0
6    z = 0
7    n = len(recipes)
8    menu_row = recipes[0]
9    for _ in menu:
10        for i in range(len(menu_row)):
11            if _ == menu_row[i]:
12                storage.append(menu_row.index(menu_row[i]))
13    for j in range(1,n):
14        for a in range(len(storage) - 1):
15            empty_lst.append([recipes[j][0]] + [recipes[j][storage[a]] + recipes[j][storage[a + 1]]])
16    return empty_lst
17
18recipes = [[None,'cake','scrambled eggs','hot tea'],
19           ['eggs',2,          4,           0     ],
20           ['milk',2,        0.5,           1     ],
21           ['bread',0,         1,           0     ],
22           ['tea',  0,         0,           2     ],
23           ['sugar',1.5,       0,           0.25  ],
24           ['flour',4,         0,           0     ]]
25menu = ['cake','hot tea']
26print(ingredients(recipes,menu))