[Edu-sig] Sample Lesson Plan

Guido van Rossum guido@python.org
Fri, 04 Feb 2000 09:13:29 -0500

Nice lesson!

I got lost with tetra() at first because it lacked a picture :-)

Also, I've never seen

  for i in range(n+1)[1:]:

to write a loop from 1 to n; it seems better to write

  for i in range(1, n+1):

You could also write

  for i in range(n):
    sum = sum + tri(i+1)

Finally, is it a pedagogical device to start with recursion and then
write a for loop?  I suppose tetra(n) is easily defined recursively:

  def tetra(n):
      if n <= 1: return n
      else: return tetra(n-1) + tri(n)

--Guido van Rossum (home page: http://www.python.org/~guido/)