I want to find a way to make it more efficient to check whether an input is = to one number or another, but the only way i've learnt and can see is using nested if's in python.
def menu():
while type(x) != int or x < 0 or x > 46:
try:
x = int(input("\nEnter a valid menu choice: "))
except:
print("\nInvalid input...\n")
if x == 1:
max1()
elif x == 2:
elif x == 3:
elif x == 4:
This is my code design for a simple menu function to call upon other functions with a user's input, however i need 46 more if x == n.
Is there a faster way than doing an elif x == n+1 every line?