0
why "else" not executed?
def f(): my code choose=input("you want to play again? y or n ?") if choose == 'y' or 'Y' : return f() else : exit() f() when I input letter not y or Y, The program still executed,please tell me why? thx !!
2 Answers
+ 4
maybe you can try to do these modifications
def f():
choose=input("you want to play again? y or n ?")
if (choose == 'y') or (choose =='Y'):
return f()
else:
print('bye')
exit()
f()
0
thank you for answer!! solved my problem , but I don't understand why do I input any letter in my code, The result always return f()?