Running on python 3.8
I was creating a menu when I realized that I needed a way to "loop" the menu if the user tried to make an invalid selection, but the final if statement basically doesn't evaluate at all.
def menu():
print("1) Generator Parameters\n2) AI Parameters\n3) Help")
choice = input("\nX ")
# converting choice to an int here
choice = int(choice)
if choice == 1:
clear()
print("You are in the Generator sub-menu")
if choice == 2:
clear()
print("You are in the AI sub-menu")
if choice == 3:
clear()
print("You are in the help sub-menu")
if 0 >= choice > 3:
clear()
print("Please make a valid selection\n")
input()
menu()
I've looked through other solutions for similar issue, however most of them being in different languages I wasn't able to identify a possible problem. (I'm new to programming)
I've run inputs 1, 2 and 3 all successfully, but anything other than those evaluates to just a blank line and a code 0.
Any ideas why I'm not getting anything?
Aucun commentaire:
Enregistrer un commentaire