I can\'t figure out why the function returns the correct letter when I enter \"N\" or \"n\". The function is called but return \"None\" when I enter the incorrect letter. The fu
With auswahl()
you are just calling your function recursively, but do nothing with the value it produces.
It would have to be return auswahl()
.
However, note that using recursion in functions that take user input is considered harmful because you can blow the stack if a user fails too many times. See the "Common Pitfalls" section of the answer I linked to.
~edit~
But if i put a return there, it gets back to main?! With recursion you mean that the function calls itself?
Yes, recursion in this contexts refers to a function calling itself. return auswahl()
does not immediately return from the function, it has to wait for the result another call to auwahl
produces. Of course, in that other call the user could fail again, which would trigger another call, and so on ...