[Tutor] Problem with python

Alan Gauld alan.gauld at btinternet.com
Wed Oct 20 00:45:22 CEST 2010


"Matthew Nunes" <matthewnunes at hotmail.com> wrote...

> ...something in the recursion chapter which have still been unable
> to understand. It wrote a piece of code for the factorial function
> .... Please explain it to me, as I have spent hours trying to get
> my head around it,

Recursion is one of the more baffling topics when you first
encounter it so don't be surprised if it takes a couple of goes
to "get it". It even trips up people who have been using it for years.

For an alternative explanation of recursion try my tutorial
(in the Advanced Topics section, under recursion(!)). I walk
through factorial cycle by cycle, see if that explanation helps.
If it does you can read a bit more more about it and its uses
in the Functional Programming topic.

If not, try forming some more specific questions around the
bits that puzzle you most. The more specific the question the
greater the chance of an answer...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list