This lesson is an introduction to programming in Python for participants with little or no previous programming experience. It uses examples that are relevant to a wide range of use cases, and is designed to be used as a prerequisite lesson for other Python based lessons.
This lesson references the Spyder IDE, but can be followed with a regular Python interpreter as well. Please note that this lesson uses Python 3.
This lesson is an adapted from the Library Carpentry Lesson “Python Intro for Libraries”
Prerequisites
Participants need to install Anaconda before the class starts. Please see the setup instructions for details.
Preparation
In preparation for the lesson, please download and save the two following two files in a folder for this workshop:
- The principles in this lesson are demonstrated with the “demonstration script”
- The exercises are written in the “exercises script”
Open the files with the Spyder editor (part of the Anaconda package).
Setup | Download files required for the lesson | |
10:00 | 1. Getting Started |
How do I use Spyder?
How can I run Python programs? |
10:20 | 2. Variables and Assignment | How can I store data in programs? |
10:50 | 3. Data Types and Type Conversion |
What kinds of data do programs store?
How can I convert one type to another? |
11:15 | 4. Morning Break | Break |
11:25 | 5. 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? |
12:00 | 6. Libraries |
How can I extend the capabilities of Python?
How can I use software that other people have written? How can I find out what that software does? |
12:30 | 7. Lunch | Break |
13:30 | 8. Lists | How can I store multiple values? |
14:05 | 9. For Loops | How can I make a program do many things? |
14:45 | 10. Afternoon Break | Break |
14:55 | 11. Conditionals | How can programs do different things for different data? |
15:25 | 12. Writing Functions | How can I create my own functions? |
15:50 | 13. Wrap-Up |
What have we learned?
What else is out there and where do I find it? |
15:55 | 14. Feedback | How did the class go? |
16:00 | Finish |
The actual schedule of the workshop might vary.