[Edu-sig] understanding recursion. . .
kirby urner
kirby.urner at gmail.com
Thu Feb 8 20:19:40 CET 2007
Andy:
But they don't have any clue that there's a call stack involved, or that
someday this could get them in trouble. I shudder to think about the
blank looks that I will get if I try to explain why it could be a problem.
I'd praise those stumbling on recursion, use the opportunity to talk about
it more specifically, and about how some languages are based on it rather
intensively (others not so much).
Greatest Common Divisor may be written both ways:
def gcd(a,b):
while b:
a, b = b, a % b
return a
or:
def gcd(a,b):
if b:
return gcd(b, a % b)
return a
But of course if your 10th graders are pathologically math phobic,
like so many of their college peers, you'll want to eschew any
such examples and deal purely with strings.
Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/edu-sig/attachments/20070208/3f600ff1/attachment.htm
More information about the Edu-sig
mailing list