[Tutor] no loops

John Fouhy john at fouhy.net
Wed Jul 12 01:23:19 CEST 2006


On 12/07/06, Christopher Spears <cspears2002 at yahoo.com> wrote:
> Now the exercise is:
> As an exercise, rewrite this function so that it
> doesn't contain any loops.
>
> I have been staring at this function and drawing a
> blank.  Something tells me that I need to use
> iteration, but I am not sure how I could implement it.

Hi Chris,

You are using iteration.  That's what loops are :-)

Perhaps you meant to say "recursion", which is where a function calls
itself.  You could solve this recursively, but I think Gregor's
comment is closer to what they want you to do.

-- 
John.


More information about the Tutor mailing list