[Tutor] Re:-Recursive Functions

Alan Gauld alan.gauld@blueyonder.co.uk
Mon Jun 2 04:00:02 2003


From: "Evripides Loizides" <loizie@hotmail.com>
> # we have the word "house" we can print all the letters:
> 
> word = "house"
> index = 0
> while index < len(word):
>    letter = word[index]
>    print letter,
>    index = index +1
> 
> 
> >>>> h o u s e

HI again. From our offline emails I think you need to take a 
step back and learn how to write normal functions first. 
Until you can do that you have no hope of writing recursive ones!

Try writing the code above as a normal non recursive function
that takes as an argument the string you want to print.

It sems to me from what you've told me and the code you sent 
that you are not used to using normal python functions yet. 
That is an essential first step to using recursion.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld