Experiences/guidance on teaching Python as a first programming language

rusi rustompmody at gmail.com
Wed Dec 11 17:27:23 CET 2013

On Wednesday, December 11, 2013 9:31:42 PM UTC+5:30, bob gailer wrote:
> On 12/11/2013 3:43 AM, Chris Angelico wrote:
> > When you tell a story, it's important to engage the reader from the
> > start...explain "This is how to print Hello World to the
> > console" and worry about what exactly the console is (and how
> > redirection affects it)
> Highly agree. I was once given FORTRAN course materials and an 
> assignment to teach this course. The first morning was spent on how to 
> construct expressions! No context as to what a program was or what it 
> might do or how to run it.

> As soon as that class was over I rewrote the materials so the first 
> morning was how to write and run(batch job submission) a program that 
> read a record, did a simple  calculation and wrote the results.

Kernighan and Ritchie set an important "first" in our field by making
"Hello World" their first program.

People tend to under-estimate the importance of this:
Many assumptions need to be verified/truthified/dovetailed
starting from switching on the machine onwards for this to work.

And its quite a pleasurable sense of achievement when it finally holds 
together -- something which is sorely missing in the Dijkstra approach.

However when we have an REPL language like python, one has the choice
of teaching the hello-world program as:

print ("Hello World")

or just

"Hello World"

The second needs one more assumption than the first, viz that we are in the
REPL, however on the whole it creates better habits in the kids.

[BTW: From the theoretical POV, imperative programming is 'unclean' because
of assignment statements.  From the practical POV of a teacher, the 
imperativeness of print is a bigger nuisance in students' thinking patterns

> I certainly felt better about teaching this way.

> Asides:

> One student (PhD in Physics) looked at X = X + 1 and said "no it doesn't".

Yes thats one issue in most modern imperative languages that the older generation
(Pascal-family) did not have, viz that assignment looks like equality.

> Another wrote his first program. I took one look at it and saw the 
> mistakes. I explained how to walk thru the program step by step. He 
> exclaimed "In that much detail?".

More information about the Python-list mailing list