Thursday, September 25, 2008

Programming Turtles to Paint in good taste

My Intro to Programming classes are finally getting to be a lot of fun. Having learned the basic tools of functional programming (control flow, types, functions...), my students can finally reap the rewards using the turtle module that's included in Python--and learn some OOP at the same time.

Teaching students to program turtles goes way back, but for me it never gets old. The image shows what a turtle can do when it moves to a random location, puts down it's pen tip and draws a somewhat randomly colored circle. I say somewhat because the parameters are tweaked in ways to prevent total random ugliness that comes from choosing colors totally randomly. Here, you see some beautiful shades of blue and purple blending together.

It hasn't been all that easy in my first semester teaching Python to students new to programming. My ELL students really struggled with syntax errors. Now, however, all my students have some of the basic tools of programming. Now it's time to let 'em go and be creative. At this point it's fun to write 3 or 4 sample programs and then watch as the students copy them, run them, and then start to alter them. When I learned to program I never had a teacher give me code to alter. Not sure why. Seems like a natural form of communication between teacher and student. It's fun to put comments in code like:

## Okay, try messing around with these variable settings
## and see what you can come up with. If you find
## something cool, share it with others!


Hélène said...


I just stumbled upon your blog looking for ideas for my intro to programming in Python course. It's turning out to be quite a challenge, with students all over the map.

Would you be willing to share some of your materials with me? You can e-mail me at lognaturel @

I would be so very appreciative!

Anonymous said...

It was certainly interesting for me to read that post. Thanks for it. I like such topics and anything that is connected to this matter. I would like to read a bit more soon.