def game():
modex = False
while modex == False:
mode = raw_input("please select a mode: ")
try:
## THE PROBLEM IS HERE!
int(mode)
if mode == 1:
modex = True
break
elif mode == 2:
modex = True
break
elif mode == 3:
modex = True
break
else:
print "invalid #. try again"
modex == False
continue
except:
print "invalid # try again"
continue
game()
i can't seem to turn mode into an integer, for example:
input: 1 output: invalid # try again
for the game i am making i have 3 modes hence the 3 modes if statement in the try-except statement
could you please help me? I am using python 2.7