Currently on my first python project to make a barista trainer, the current problem I am running into is that depending on the drink/recipe I need to ask a different number of questions. I have a (I think) good way to get the questions I need, the program asks them, but I cant take that input and assign them to a variable.
The code I have so far...
This is the call to my questions class
questions = Questions.get_questions((recipe_label.lower()))
This is where I get the input
for question in range(len(questions)):
answer = input(questions[question]).split("\n")
The gap here is the part I can not figure out.
Where I call the class that creates the recipe based on input
recipe = Recipe_Factory.get_recipe(recipe_label, size_label, hot_label)
I have tried making a questions class, I tried using a for loop to assign each input to a list of variables, and some other stuff that super did not work at all, I honestly don't even care if it works the way I am trying, just need an intuitive way to have a changing number of questions and answers.
what I am expecting:
recipe_label = input(what do you want to practice)
#questions is a list of strings, the strings are the questions I'm asking
questions = Questions.get_questions((recipe_label.lower()))
Based on input, number of questions change
for question in range(len(questions)):
answer = input(questions[question]).split("\n")
x, y, z, are the input values
x = input 1
y = input 2
z = input 3
#this is the call to actually build the recipe
recipe = Recipy_Factory(x,y,z)