Start here
This is a complete Python course for beginners: from your first line of code to functions, loops, errors, libraries, tests, files, regular expressions and classes. It follows the syllabus of Harvard's CS50P (CS50's Introduction to Programming with Python), one of the best free programming courses there is.
How each module works
- The written lessons are the course: they explain every idea with the code that matters, so you can learn everything from them alone.
- Harvard's lecture is optional. It sits on top of each module's first lesson for anyone who likes learning by video. Skip it, or watch it in parts: inPace remembers where you stopped.
- Practice: a small program to write, a question to answer in your own words, and a quiz.
Your plan: 11 weeks, about an hour a day
| Week | Module | Optional lecture |
|---|---|---|
| 1 | Functions and variables | 1 h 46 min |
| 2 | Conditionals | 56 min |
| 3 | Loops | 1 h 21 min |
| 4 | Exceptions | 45 min |
| 5 | Libraries | 1 h 18 min |
| 6 | Unit tests | 51 min |
| 7 | File I/O | 1 h 32 min |
| 8 | Regular expressions | 2 h 05 min |
| 9 | Object-oriented programming | 2 h 51 min |
| 10 | Et cetera | 2 h 29 min |
| 11 | Final project | none |
Set up your computer
- Install Python 3 from python.org/downloads. On Windows, tick Add python.exe to PATH on the first screen.
- Install VS Code and its Python extension.
- Make a folder for this course, open it in VS Code, and create a file named
hello.py:
print("hello, world")
- Open the terminal (Terminal → New Terminal) and run it:
python hello.py(on Mac and Linux,python3 hello.py).
Can't install anything? Use cs50.dev, Harvard's free editor in the browser (sign in with GitHub).
Going further
- The official Python tutorial: docs.python.org/3/tutorial
- Harvard's notes and problem sets for every week: cs50.harvard.edu/python