[Tutor] help with a recursive function

Alan Gauld alan.gauld at btinternet.com
Wed Sep 28 03:09:24 CEST 2011

On 27/09/11 19:32, c smith wrote:
> i understand the general idea of recursion and if I am following well
> written code I can understand how it works, but when I try to write it
> for myself I get a bit confused with the flow.

Others have dealt with the specifics.

If you really want to learn how to use and write recursive code there is 
(IMHO!) no better place to go than the online book How To Design 
Programs. It's written using Scheme but the code is clear enough that 
you should translate to Python easily. You probably only need to read 
the first 4 chapters or so. The author builds up a set of heuristics for 
defining recursive solutions - i.e. writing functions!



Alan G.

More information about the Tutor mailing list