-
Notifications
You must be signed in to change notification settings - Fork 1
/
user_prompts.py
105 lines (88 loc) · 3.46 KB
/
user_prompts.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
from word_transformations import Transformer
# From piazza post @53:
# Each transformation should produce an output. Imagine the following sequence of interactions:
# 1. Program asks for a recipe URL;
# 2. User enters said URL;
# 3. Program displays the parsed recipe;
def search_url_input():
url_or_keywords = input("Please enter a recipe url: \n")
return url_or_keywords.strip()
# 4. Program shows a predefined set of transformations as a numbered list;
def set_transformations():
print("Please enter the number of the transformation you want")
# To and from vegetarian (REQUIRED)
print("1 - From vegetarian to non-vegetarian")
print("2 - From non-vegetarian to vegetarian")
# To and from healthy (REQUIRED)
print("3 - From healthy to non-healthy")
print("4 - From non-healthy to healthy")
# Style of cuisine (AT LEAST ONE REQUIRED)
print("5 - Transform to Chinese cuisine")
print("6 - Transform to gluten-free")
print("7 - Transform to non gluten-free")
print("8 - Transform to Thai cuisine")
# Additional Style of cuisine (OPTIONAL)
# print("6 - Transform to Y cuisine")
# DIY to easy (OPTIONAL)
# print("7 - DIY to easy")
# Double the amount or cut it by half (OPTIONAL)
# print("8 - Double the amount")
# print("9 - Reduce the amount by half")
# Cooking method (from bake to stir fry, for example) (OPTIONAL)
# print("10 - Change cooking method")
# 5. User enters a number within said list;
# 6. Program displays the output of the selected transformation
def transformation():
selected_transformation = input()
print("\n")
if selected_transformation == "1":
print("--Transformed recipe to non-vegetarian--")
elif selected_transformation == "2":
print("--Transformed recipe to vegetarian--")
elif selected_transformation == "3":
print("--Transformed recipe to non-healthy--")
elif selected_transformation == "4":
print("--Transformed recipe to healthy--")
elif selected_transformation == "5":
print("--Transformed to Chinese cuisine--")
elif selected_transformation == "6":
print("--Transformed to gluten-free--")
elif selected_transformation == "7":
print("--Transformed to non gluten-free--")
elif selected_transformation == "8":
print("--Transformed to Thai cuisine--")
# elif selected_transformation == "6":
# print("~Transformed to Y cuisine~")
# elif selected_transformation == "7":
# print("~Transformed to easy~")
# elif selected_transformation == "8":
# print("~Doubled the amount~")
# elif selected_transformation == "9":
# print("~Reduced the amount by half~")
# elif selected_transformation == "10":
# print("~Changed cooking method~")
else:
print("Please enter a number 1-8")
transformation()
return int(selected_transformation)
# 7. Program asks if the user would like to continue transforming the recipe or start from scratch with a new recipe;
def continue_startover():
print("Please enter: ")
print("1 - If you would like to continue transforming this recipe")
print("2 - If you would like to start over with a new recipe")
print("3 - If you would like to exit")
# 8. User enters an option;
# 9. Program goes back to #1 or continues to iterate over the previously transformed recipe.
# todo: abstract this out so we can use oru classes for it
def next_step():
selected_option = int(input())
if selected_option not in range(1, 4):
print("Please enter 1, 2, or 3")
next_step()
return selected_option
if __name__ == '__main__':
search_url_input()
set_transformations()
transformation()
continue_startover()
next_step()