Plotting and Programming in Python

This lesson is an introduction to programming in Python 3 for people with little or no previous programming experience. It uses plotting as its motivating example and is designed to be used in both Data Carpentry and Software Carpentry workshops. This lesson references JupyterLab but can be taught using alternative Python 3 interpreters as well (e.g., repl.it, Anaconda).

Prerequisites

  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 install Python 3 before the class starts.

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

    Please see the setup instructions for more details.

Schedule

Setup Download files required for the lesson
00:00 1. Running and Quitting How can I run Python programs?
00:15 2. Variables and Assignment How can I store data in programs?
00:35 3. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
00:55 4. Built-in Functions and Help How can I use built-in functions?
How can I find out what they do?
What kind of errors can occur in programs?
01:20 5. Morning Coffee Break
01:35 6. Libraries How can I use software that other people have written?
How can I find out what that software does?
01:55 7. Reading Tabular Data into DataFrames How can I read tabular data?
02:15 8. Pandas DataFrames How can I do statistical analysis of tabular data?
02:45 9. Plotting How can I plot my data?
How can I save my plot for publishing?
03:15 10. Lunch Break
04:00 11. Lists How can I store multiple values?
04:20 12. For Loops How can I make a program do many things?
04:45 13. Conditionals How can programs do different things for different data?
05:10 14. Looping Over Data Sets How can I process many data sets with a single command?
05:25 15. Afternoon Coffee Break
05:40 16. Writing Functions How can I create my own functions?
06:05 17. Variable Scope How do function calls actually work?
How can I determine where errors occurred?
06:25 18. Programming Style How can I make my programs more readable?
How do most programmers format their code?
How can programs check their own operation?
06:55 19. Wrap-Up What have we learned?
What else is out there and where do I find it?
07:15 20. Feedback How did the class go?
07:30 Finish

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