1

I have this menu and I'm using the I variable to choose an option, asking input for the number.

This is the code

print("1: option1")
print("2: option2")
print("3: option3")
I=input()
if I == 1:
    print ("option1 selected")
elif I == 2:
    print("Option2 selected")
elif I == 3:
    print("option3 selected")
else:
    print("invalid input")

However if i press 1, 2 or 3 as input, it prints invalid input.

Maybe the identation is wrong or maybe I have to declare the variable?

Thanks in advance.

0 Answers0