def answer():
if True:
ans = raw_input('Enter y/n:')
if ans != "y" and ans != "n":
print "Try again"
answer()
elif ans == "n":
return False
elif ans == "y":
return True
if answer():
print "It's working!, you entered Y"
else:
print "You entered N"
When I execute this code, I press Enter several times or enter wrong letters, then I enter y, I always get "You entered N" instead of "It's working!, you entered Y" .
I can't figure out what's the problem, please help me.