[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[seul-edu] Exercises for teaching programming to 7 year old
Well, with all this talk about teaching programming to children, I thought
it was time to get started with my seven year old boy.
As I pointed out in an earlier post, I'm just learning Python myself, and
want to use this language to teach my children (and learn at the same
time). So, yesterday, after I briefly reviewed the Python tutorial, we
started with a simple little exercise: making a function.
I had him start the Python interpreter and enter the following:
>>> def best(guy):
... best=guy+" is the best."
... print best
...
And then, once we had created this function, I had him try it out. He
started with:
>>> best("robert")
robert is the best.
and so forth, listing each of his friends' names in turn. The
line-editing keys really helped save a lot of keystrokes here. He is
familiar with line-editing from using bash, so he knew right away what to
do without being told.
Then after showing him what was happening in this function, I said "OK,
now you make a function".
What he did was try to make a function just like mine. Except his had an
unexpected bug, as the screen had scrolled a bit so my function wasn't
always in view as he typed his. His function looked like this (after we
had corrected the inevitable syntax errors from missed punctuation):
>>> def best(guy):
... best=guy+guy+" is the best."
... print best
...
And so, when he used it, he entered:
>>> best("robert")
and was surprised to see:
robertrobert is the best.
Well, this put him in fits of giggles. He tried several other names after
this and we had a good laugh over it. I showed him the difference between
his function and mine, and I think he appreciated what had gone wrong.
Finally, I took over the keyboard and showed him one more function (his
attention span nearly exhausted at this point):
>>> def best2(guy,thing):
... best=guy+" is the best "+thing+"."
... print best
...
>>> best2("Robert","racecar driver")
Robert is the best racecar driver.
Then I gave him back the keyboard to try a few different sentences. I
think at this point he appreciated the flexibility of this new function
compared with the old.
I find about 10 minutes is as long as I can hold his attention at this
point. I'd love to do more complex things with him, but bigger projects
need to be designed with breaks to fit into smallish chunks of time.
Another constraint is typing. Although he is comfortable with typing,
he's still not very fast or accurate, and therefore I try to minimize
amount of typing he needs to do.
As for where he stands developmentally, I feel my son is developed beyond
his years verbally and spatially, and about average with his concept of
number. What I'd like to accomplish with him over the next six weeks is
to start thinking with procedures, and develop an ability to come up with
his own functions with some assistance with typing and correcting errors
(although I'm encouraging him to learn as we go how to fix some of these
himself).
Does anyone have anecdotes to share from teaching children at this level
of development, or suggestions for programming exercises? I'm sure
between the two of us, my son and I will come up with plenty of ideas, but
I think it would be fun and helpful to compare notes with others who are
doing the same thing.
Ben
--
nSLUG http://www.nslug.ns.ca synrg@sanctuary.nslug.ns.ca
Debian http://www.debian.org synrg@debian.org
[ pgp key fingerprint = 7F DA 09 4B BA 2C 0D E0 1B B1 31 ED C6 A9 39 4F ]
[ gpg key fingerprint = 395C F3A4 35D3 D247 1387 2D9E 5A94 F3CA 0B27 13C8 ]