I am super new to coding and am coding for an assignment for school and am having trouble doing an if statement assuming that’s what I should even be using but I want to be able to ask a question and have an if statement decide if the input is yes or no so it would be like if variable = yes print(“blahblah”) I don’t know if that’s even the best way to go about doing this but I am having a lot of trouble with it. Any help would be wonderful Repl link:
I’m not asking for you to do my assignment I’m just asking for some help with putting in an if statement i’m sure if my teacher was here she would help me.
functions = {}
drink = None
def wrapper(command: str):
global functions
def within_wrapper(func):
global functions
functions[command] = func
return within_wrapper
@wrapper("yes")
def yes_func():
global drink
drink = input("Hello! What drink would you like?")
@wrapper("no")
def no_func():
print("You chose no!")
def process_input(text: str, secondary_fall_back_text: str = ""):
current = input(text)
while True:
if (current in functions):
functions[current]()
break
else:
print("That is not a valid option. Please try again.")
current = input(secondary_fall_back_text)
process_input("Would you like a drink?")