Introduction to programming with Python

This lesson is an introduction to programming in Python for librarians with little or no previous programming experience. It uses examples that are relevant to a wide range of library use cases, and is designed to be used as a prerequisite lesson for other Python based lessons that will be developed in the future, e.g. using the Pandas for data analysis.

This lesson references the Spyder IDE, but can be taught using a regular Python interpreter as well. Please note that this lesson uses Python 3 rather than Python 2.

Under Design

This lesson is currently in its early design stage; please check the design notes to see what we have so far. Contributions are very welcome: we would be particularly grateful for exercises and for commentary on the ones already there.


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

  2. Learners must install Anaconda before the class starts.

    Please see the setup instructions for details.


Setup Download files required for the lesson
09:00 1. Getting Started How do I use the Spyder IDE?
How can I run Python programs?
09:15 2. Variables and Assignment How can I store data in programs?
09:35 3. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
09: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?
10:20 5. Morning Coffee Break
10:35 6. Libraries How can I use software that other people have written?
How can I find out what that software does?
10:55 7. Lunch Break
11:40 8. Lists How can I store multiple values?
12:00 9. For Loops How can I make a program do many things?
12:25 10. Writing Functions How can I create my own functions?
12:50 11. Variable Scope How do function calls actually work?
How can I determine where errors occurred?
13:10 12. Afternoon Coffee Break
13:25 13. Conditionals How can programs do different things for different data?
13:50 14. Programming Style How can I make my programs more readable?
How do most programmers format their code?
How can programs check their own operation?
14:20 15. Wrap-Up What have we learned?
What else is out there and where do I find it?
14:40 16. Feedback How did the class go?
14:55 Finish

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