I am trying to build a class feature where my player selects a class for a choose your own adventure game I am building. My code looks as such:
def class_choice(choice1, choice2, choice3, choice4):
choice = input("What class would you like to select? Note that you must type the class \ exactly as displayed: ")
if choice == choice1:
print("You have selected the Engineer class!")
def engineer_start(choice1, choice2):
input("test")
if choice == choice2:
print("You have selected the G.I. class!")
input("test")
if choice == choice3:
print("You have selected the F.S.S. class!")
input("test")
if choice == choice4:
print("You have selected the Journalist class!")
input("test")
if choice != class_choice('Engineer', 'G.I.', 'F.S.S.', 'Journalist'):
print()
print(f"{choice} is not a valid input!")
return class_choice(choice1, choice2, choice3, choice4)
class_choice('Engineer', 'G.I.', 'F.S.S.', 'Journalist')
My issue is that when a player does not put in a correct input, it does return to the initial function (class_choice), but it does not execute 'if choice != class_choice'.
I tried writing out:
if choice != class_choices(choice1, choice2, choice3, choice4):
print()
print(f"{choice} is not a valid input!")
return return class_choice(choice1, choice2, choice3, choice4)
My hope was that by changing the choices to be changed later when I define my arguments, it would check if the argument was one of my choices, and if not, return to them the original function. However, it feels like it completely skips over that line of code!