file " :\test py"line in eggs spam(file " :\test py"line in spam eggs(file " :\test py"line in eggs spam(file " :\test py"line in spam eggs(runtimeerrormaximum recursion depth exceeded preventing stack overflows with base case in order to prevent stack overflow bugsyou must have base case where the function stops make new recursive calls if there is no base case then the function calls will never stop and eventually stack overflow will occur here is an example of recursive function with base case the base case is when the param parameter equals def fizz(param)print(paramif param = return fizz(param fizz( when you run this programthe output will look like this this program does not have stack overflow error because once the param parameter is set to the if statement' condition will be true and the function will returnand then the rest of the calls will also return in turn though if your code never reaches the base casethen this will cause stack overflow if we changed the fizz( call to fizz( )then the program' output would look like thisfile " :\rectest py"line in fizz fizz(param file " :\rectest py"line in fizz fizz(param file " :\rectest py"line in fizz