# [Edu-sig] My experience teaching Python

Dustin James Mitchell djmitche@cs.uchicago.edu
Tue, 22 Feb 2000 14:10:05 -0600 (CST)

```On Tue, 22 Feb 2000, Martijn Faassen wrote:

> 'for' loops presented more problems, though! I had quite a bit of difficulty
> to explain that the for block gets executed for each element in the sequence,
> and that the variable (for variable in foolist) refers to something else
> each time in the execution. I need to think on a better way to express
> things apparently-tricky thing.

I had the same troubles.  Anybody got any brainstorms on this one?

> After that I had them change the function to multiply instead of doing
> additions (so you'd do factorials). Due to my explanation that you can
> use basically any word for a variable, and also focusing on the idea that
> you should use descriptive variables, my friend and her daughter automatically
> started to change variables like 'sum' to 'product', and not only changed
> the + to *. This was a rather nice thing to see, though I hope it wasn't
> because they taught the computer actually understands what they call
> these variables (I don't think they did think that though). Also tricky was
> to change the starting value of '0' to '1' (otherwise the result is '0'), but
> they both could figure this out for themselves.

And that's a math issue, not a programming issue.  It's always nice to
cross people over that gap, because math like that (0 times anything is 0)
is something everyone is familiar with, and thus grounds the learning in
something familiar.

> That's about as far as I got this time. As you see you can spend lots of
> time with the basics. This is not because the mechanisms of the basics
> are generally hard to understand; they picked those up pretty well in
> general, though there were some problems. The problem is more one of
> *why* these mechanisms are useful. What you can do with them, and how
> you use them to do useful things. That's the real art of programming
> (along with the importance of a well readable and maintainable program
> structure).

You picked a good set of basics to start with.  For some people, however,
who are 'innumerate', Python's string facilities can be useful -- use
looping over sequences to do various manipulations of words and
sentences...

> I hope my observations were of any use to you all; I'll post more once I
> have some more experience.

Yes, thank you.  THis kind of discussion is very helpful.

---------------------------------------------------------------------
|                         Dustin Mitchell                )O(        |
---------------------------------------------------------------------

```