On 8/11/06, Paul D. Fernhout <[EMAIL PROTECTED]> wrote: > Again, both the Smalltalk-sh prototype code and the PataPata example are > doing more -- by building objects which respond to messages. But whereas > Kirby starts with recursion as important (levels of nesting), from a > Smalltalk-ish OO point of view (and by extension, OO simulation) getting > kids to understand the abstraction of objects receiving and processing and > sending messages may be seen as more important. :-)
Actually, I don't start from recursion first off. The numeracy0.html was written some time ago and I've had more experience teaching math with Python since then. For a more current view (the course I taught to 8th graders twice last year), see: http://www.4dsolutions.net/ocn/winterhaven/ This is the page I shared with the London Knowledge Lab (LKL) last year (URL to Quicktime earlier given). [ This was pre opening my PKL in the new Portland Tech District. http://worldgame.blogspot.com/2006/08/toontown.html ] You'd probably find my approach convenient, as I start into dot notation right off -- the way we intereact with objects in more than just Python (its a prevalent convention). We play with built-ins to study this: strings, lists and dictionaries (I describe the differences) i.e. so-called data structures (data structures + dot notation = my current intro). OK, *then* maybe I tell the story of young Gauss, his class being punished by the teacher (they get that) to add all consecutive integers from 1 to 100. Gauss had this flash that writing the sequence twice, the lower version in reverse order, would give him the same sum over and over. Let's demonstrate in Python: >>> seq = range(1,11) >>> reversed(seq) <listreverseiterator object at 0x00D0DAB0> >>> for i in reversed(seq): print i 10 9 8 7 6 5 4 3 2 1 >>> zip(seq, reversed(seq)) [(1, 10), (2, 9), (3, 8), (4, 7), (5, 6), (6, 5), (7, 4), (8, 3), (9, 2), (10, 1)] >>> [i+j for i,j in zip(seq, reversed(seq))] [11, 11, 11, 11, 11, 11, 11, 11, 11, 11] So what Gauss figured is he'd need 100 101s to get the sum of the two sequences, which is easy 10100, but divide by 2 to get the sum that'll please the teacher so 5050. Did it all in his head, really pissed the teacher off. This actually motivates a discussion of triangular numbers, as a sequence of sums of consecutive integers, starting from 1 (or 0 if you like). We're now in a position to explore more of Python's builtins, especially range (gotta go over the above, make it comprehensible). But there's a chance to segue to slice notation if we like (trapezoidal numbers anyone?). OK, so THEN I show them how to define a function in Python: >>> def gauss(n): """ How Gauss pissed off his teacher """ return n * (n + 1 ) / 2 >>> tri = gauss >>> tri(100) 5050 Kirby _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
