I'm looking to use functions within my Python program to make it cleaner and more efficient, Within my function I either return true or false depending on a user's selection. Though in the case they enter an incorrect / invalid response, I'd like to return a return that way asking more questions don't be asked.
Edit:
To be a bit more descriptive; I'd like to re-create this:
def askquestion(question):
response = input(question, "Enter T or F")
if response == "T":
return True
elif response == "F":
return False
else:
return None
def askmultiple():
questionOne = askquestion("Do you fruits?")
if questionOne == None:
return # Exit the function, not asking more questions
questionTwo = askquestion("Do you Apples?")
if questionTwo == None:
return # Exit the function, not asking more questions
I want to cut out checking afterwards if it is None
and just return return.