Today was my 4th session in a sequence of nine.

I think the way it's developing for me is I hand out worksheets, which pose questions around Python, and students have the option to just fill them in, knowing Python "in their heads" well enough to not consult the actual interpreter. Others run the questions through Python. Others do a little of both. Worked pretty well today. The kids seemed very engaged. I walked around helping and explaining. We were in learning mode, not "prove to me you already know it" mode.

We started out with an xmlrpclib demo. My setup was lame: Ethernet from my laptop to a neighboring PC, with an air gap to the actual PPS intranet. So of course it didn't work. Even after fixing the link, I was having problems. But some of the kids got their examples to work. In a way that was good: teacher in a group with floundering students, other students having it work. Very democratic.

At the very end of the class, I retold the story about the young Gauss, this time suggesting he did the whole thing in his head. Like, the teacher said add 1 to 100 and he said hmmmm, that's range(1,101) and range(100, 0, -1) on top of each other, and a sum of 101, 101, 101... 100 times = 100(101). But that's twice the sum you need, so voila, 5050, in like 8 seconds. Stunned teacher.

I explained why such consecutive sums-from-1 are considered "triangular" and threw out this challenge: class is about to end, but if anyone thinks they can do this:

def tri(n):

# something goes here

return answer

then let me know now. Type type type. A hand goes up. I quickly memorize the student's solution and transfer it to the screen up front (laptop -> projector -> screen):

def tri(n):

num = n * (n + 1)

num = num / 2

return num

(actually the student said 'print num' and I said that'd be OK too).

And yes, tri(100) returns 5050, so big win. The kids felt one of their own had risen to the challenge, not in a competitive way, but as their representative. A peer had passed a tough test on their behalf.

Note: using "__past__ style" division is OK in this context, as n, n+1 must form an even/odd pair, meaning their product is even, meaning 2 divides with no remainder (i.e. integer division OK).

Kirby