How I teach Python with open source tools

Teaching Python to others is easy with these open source tools and techniques.
5 readers like this.
How to do open research: 5 basic principles

Opensource.com

I love to teach Python. I start by beginning where the learner begins. My first question is, "How would you like to learn Python?"

They usually answer, "What's Python?"

That's when I give them some examples of websites built with Python they might already be familiar with. I also provide examples of using Python in data science, engineering, web development, and, most recently, artificial intelligence and machine learning.

Most folks are intimidated when you try to introduce computer programming because their first efforts failed or someone told them programming is difficult. I show them a simple print statement that easily demonstrates how much the Python syntax is like the language they speak.

>>> print("Hello World")
Hello World

Unless they are Linux or macOS users, they might need help installing Python on their computer. I guide them through downloading Python from the Python.org website and installing it on their computer. Next, I help them set up a development environment. For many users this is IDLE.

A good Python IDE

For a young student, I introduce Mu, a great development environment for elementary and middle school students. Adults and older students might use VSCodium.

Python REPL

I often introduce new users to the REPL so they can execute their code easily. Then I show them how to write a simple program with a print statement print("Hello World") and save it as a text file with a .py extension. I explain that the .py extension is necessary for Python to recognize the program.

Turtle

Then I introduce them to Python fundamentals, including variables, strings, numbers, and basic operations. I suggest Python libraries like the Turtle, which even adults find fascinating. I start simply in the REPL:

import turtle  
turtle.forward(100)
turtle.right(90)

This example demonstrates how easy it is to write code in Python and how just a few lines can produce a graphic on their display. Then I show how to draw a square:

import turtle
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)

Then I cover control structures like the if statement, elif, for, and while. I demonstrate drawing that same square quickly and easily with a for loop:

import turtle
for x in range(4):
    turtle.forward(100)
    turtle.right(90)

Teaching Python is a gift

When you teach, it's important to begin where the learner is and engage them in their own edification. This approach has them leaning in for more information, ensuring they gain skill and competency.

Your local public library might be a great place to find students who would like to learn Python. Most libraries would be very happy to have you volunteer to help their patrons.

What to read next
User profile image.
Educator, entrepreneur, open source advocate, life long learner, Python teacher. M.A. in Educational Psychology, M.S. Ed. in Educational Leadership, Linux system administrator.

4 Comments

i learned to program in middle school in Brazil, in the 80s using LOGO and the turtle. Good to see it still alive and well in Python! Good work, Don!

Anderson that was my segue into Python. I learned LOGO when I was in graduate school in the late 1980's and then taught it In our elementary school. A friend of mine introduced me to Python and then demonstrated the 'turtle' module and my connection with LOGO, Seymour Papert and helping students to have fun with Math was rekindled.

In reply to by ansilva

One of my favorite ways to learn a new programming language is to take someone else's Python script and play with it -- modify various features of commands in the script and see what the result is.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.