-
Notifications
You must be signed in to change notification settings - Fork 1
/
display_veges.py
109 lines (95 loc) · 3.85 KB
/
display_veges.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import script
import helper
import healthy
def merge_ingredient(ingredient):
return str(ingredient['quantity'])+ ingredient['measurement']+ ingredient['ingredient_name']+ingredient['preparation']
def display_healthy(ingredients, tools, methods, steps):
ingredients,methods, steps = healthy.transform_to_healthy(ingredients, tools, methods, steps)
print('-------Ingredients-----')
for ingredient in ingredients:
print(merge_ingredient(ingredient).rstrip(','))
print('..........')
print('name:', ingredient['ingredient_name'].rstrip(','))
print('quantity:', ingredient['quantity'])
print('measurement:', ingredient['measurement'])
print('preparation:', ingredient['preparation'])
print()
print('\n-------Tools-----')
for tool in tools:
print(tool)
print('\n-------Methods-----')
for method in methods:
print(method)
print('\n-------Steps------')
cnt = 1
for step in steps:
print("step", cnt)
print(step[0].strip())
print('..........')
if len(step[1]['ingredient']) != 0:
print('ingredients: ', end = '')
for ing in step[1]['ingredient'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['ingredient'][-1])
if len(step[1]['cooking tools']) != 0:
print('cooking tools: ', end = '')
for ing in step[1]['cooking tools'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['cooking tools'][-1])
if len(step[1]['cooking methods']) != 0:
print('cooking methods: ', end = '')
for ing in step[1]['cooking methods'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['cooking methods'][-1])
if len(step[1]['time']) != 0:
print('cooking time: ', end = '')
for ing in step[1]['time'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['time'][-1])
print()
cnt+=1
def display_unhealthy(ingredients, tools, methods, steps):
ingredients,methods, steps = healthy.transform_to_unhealthy(ingredients, tools, methods, steps)
print('-------Ingredients-----')
for ingredient in ingredients:
print(merge_ingredient(ingredient).rstrip(','))
print('..........')
print('name:', ingredient['ingredient_name'].rstrip(','))
print('quantity:', ingredient['quantity'])
print('measurement:', ingredient['measurement'])
print('preparation:', ingredient['preparation'])
print()
print('\n-------Tools-----')
for tool in tools:
print(tool)
print('\n-------Methods-----')
for method in methods:
print(method)
print('\n-------Steps------')
cnt = 1
for step in steps:
print("step", cnt)
print(step[0].strip())
print('..........')
if len(step[1]['ingredient']) != 0:
print('ingredients: ', end = '')
for ing in step[1]['ingredient'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['ingredient'][-1])
if len(step[1]['cooking tools']) != 0:
print('cooking tools: ', end = '')
for ing in step[1]['cooking tools'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['cooking tools'][-1])
if len(step[1]['cooking methods']) != 0:
print('cooking methods: ', end = '')
for ing in step[1]['cooking methods'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['cooking methods'][-1])
if len(step[1]['time']) != 0:
print('cooking time: ', end = '')
for ing in step[1]['time'][:-1]:
print(ing.strip(), end = ', ')
print(step[1]['time'][-1])
print()
cnt+=1