Aug-01-2017, 09:02 AM
Thanks so much responding to my query, really is appreciated. I've looked at your code here and on stackoverflow. It looks great and would work! However, I'm completing this piece of code as an exercise.The recursive depth won't be that great, so doesn't have to be the most efficient code. What I'm really battling with is this....
I went to pythontutor.com, which is great to debug your code. So I put the code in there, and am seeing that a new "stack" is being using for the recursive parts of the code. However, the "main" maxnum is never updated from the other "stacks". So I'm wondering in particular what I'd need to do to my code to get it to work, or if I should then rethink the whole thing and do it iterativly as you've shown. However saying this the exercise as mentioned is trying to show me how to do recursive programming. If I'm not allowed to do anything outside of the function, as per your first python code on this page, what would you suggest I do?
Hope this makes sense, just bear with me being such a noob at this.... :P
I went to pythontutor.com, which is great to debug your code. So I put the code in there, and am seeing that a new "stack" is being using for the recursive parts of the code. However, the "main" maxnum is never updated from the other "stacks". So I'm wondering in particular what I'd need to do to my code to get it to work, or if I should then rethink the whole thing and do it iterativly as you've shown. However saying this the exercise as mentioned is trying to show me how to do recursive programming. If I'm not allowed to do anything outside of the function, as per your first python code on this page, what would you suggest I do?
Hope this makes sense, just bear with me being such a noob at this.... :P