This lesson is being piloted (Beta version)
If you teach this lesson, please tell the authors and provide feedback by opening an issue in the source repository

Programming with Python

In presenting the two available Python lessons, Programming with Python and Plotting and Programming in Python, we found that we preferred the structure of the former but the dataset and Pandas module used in the latter. This lesson thus follows the structure of Programming with Python but uses the Gapminder dataset and examples which makes use of Pandas rather than Numpy.

Pandas is suitable for data analysis and manipulation. If a more numerical approach is required for the learners, then the lesson, Programming with Python that uses the Numpy module, might be more suitable. Numpy is primarily used for performing numerical calculations. This lesson serves as an introduction to Python 3 for people with little or no previous programming experience.


  1. Learners need to understand what files and directories are, what a working directory is, and how to start a Python interpreter,

  2. Learners must have Python 3 installed or have access to an instance of Jupyter Notebook before the class starts.

  3. Learners must get the gapminder data before the class starts: please download and unzip the file

Please see the setup instructions for more details.


Setup Download files required for the lesson
00:00 1. Python Fundamentals What basic data types can I work with in Python?
How can I create a new variable in Python?
How do I use a function?
Can I change the value associated with a variable after I create it?
00:30 2. Analyzing Data What dataset are we using today?
How can I process tabular data files in Python?
01:30 3. Visualizing Data How can I plot my data?
How can I save my plot for publishing?
02:00 4. Storing Multiple Values in Lists How can I store many values together?
02:45 5. Repeating Actions with Loops How can I do the same operations on many different values?
03:25 6. Analyzing Data From Mutliple Files How can I do the same operations on many different files?
03:55 7. Making Choices How can my programs do different things based on data values?
04:35 8. Creating Functions How can I define new functions?
What’s the difference between defining and calling a function?
What happens when I call a function?
05:15 9. Errors and Exceptions How does Python report errors?
How can I handle errors in Python programs?
05:55 10. Defensive Programming How can I make my programs more reliable?
06:35 11. Debugging How can I debug my program?
07:25 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.