Question: Number Game Refinement
I've got a question about the code shown in the Number Game Refinement video of Python Basics. Here's the setup: So, Kenneth (an awesome teacher, by the way) builds a function called game(). Inside the game() function, he calls the game() function again to keep playing (if the user doesn't type "n").
So, we're writing a function that actually calls itself... does that work? Is that good program design?
Just confused, Thanks! D.
This is called recursion, and it's very useful in a lot of situations. For this particular program, it would probably be better to use a while loop to check while the response is not "n".