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 !!

25th Aug 2017, 4:34 AM
çŽ‹æŸć‡±
çŽ‹æŸć‡± - avatar
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()
25th Aug 2017, 5:11 AM
Daniel
Daniel - avatar
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()?
25th Aug 2017, 6:27 AM
çŽ‹æŸć‡±
çŽ‹æŸć‡± - avatar