[Tutor] Recursion help
Alan Gauld
alan.gauld@blueyonder.co.uk
Fri Aug 1 03:40:01 2003
> You can look at it this way:
> printList((1,2,3))
> prints (1,2,3)[0] which is 1
> runs printList((1,2,3)[1:]) = printList((2,3))
> now we're in printList((2,3))
> prints (2,3)[0] which is 2
> runs printList((2,3)[1:]) and so on ...
I modified it slightly and expanded it to completely describe the
function. I also added a brief explanation about using slicing
[1:] to get the end of the list.
See what you think here:
http://www.freenetpages.co.uk/hp/alan.gauld/tutrecur.htm
HTH,
Alan G
without Guido's time machine...