Your controlled assessment (worth 30%) starts after Easter. To prepare for this complete this homework to the best of your ability.
Recipe Finder Task
Task 1
You need to ask the user a series of questions to help find a certain recipe.
E.g. The first question could be "Do you want a veg or non-veg recipe?" If the user says "Veg" the next question could be "Do you want to a Salad recipe or a Pasta recipe?". If the user says "Pasta" you could then ask.... and so forth until finally you recommend a recipe e.g. "We suggest you make a Tomato, cheese and broccoli pasta bake".
(Hint: This was a bit like the wizard game you made)
Ensure you cover both upper and lower case options e.g. "Veg" and "veg".
Task 2
What if the user responds with "I would like a veg recipe"
Your program now needs to look through the list of words and pick out veg. So if the word "veg" is in the sentence the program can now continue as normal.
You may need to use the internet to help find some examples and resources for this.
Try this link as a starting point. Link
Do not give up here, you need to complete this task.
Task 3
Producing the recipe from a text file
Have a list of key words and recipes in a text file.
Open the recipe from a text file if a key word is used.
Example code
while True:
file = open("people.txt", "r")
lines = file.readlines()
numberoflines = len(lines)
job = input ("What job? ")
file = open("people.txt", "r")
for loop in range(numberoflines):
line = file.readline()
data = line.split(",")
if data[2] == job:
print(data[0],data[1])
file.close()
Good luck and Happy Easter
that link has confused me sir
ReplyDelete