How this course works
The lessons are in a fixed order, and each one uses only what came before it. Start at lesson 1 even if you have tried Python before. It takes a few minutes and makes sure your set-up works.
- Read a lesson with Python open beside it. Type each example yourself and run it. Typing is slower than copying, and that is the point: your fingers learn the brackets, colons and indents.
- Change the example. Before moving on, alter a number or a word and guess what will happen. Then run it. A wrong guess teaches more than a right one.
- Do the exercises before opening the answers. Each lesson has three. Your answer does not have to match ours. If it prints the right result, it is right.
- Mark the lesson as done. The button at the end of each lesson puts a tick against it on this page. The ticks are kept in your own browser. We do not see them.
Half an hour a day is enough. At that pace the 21 lessons take about a month, and you will remember more than if you rush through them in a weekend.
What you need
A way to run Python. That can be Python installed on a computer, a website with a Python box, or an app on a phone. Our set-up page explains all three. You do not need to be good at maths. The sums in these lessons are the ones you do in a shop.
What you will be able to do at the end
- Read and write small Python programs with confidence.
- Ask the user for input and check it.
- Make decisions and repeat work with
if,whileandfor. - Store and organise data in lists and dictionaries.
- Split a program into functions and use Python's built-in modules.
- Save data to a file and read it back.
- Understand an error message and fix its cause.
After the lessons, the small projects put the pieces together: a guessing game, a marksheet, a bill splitter and a word counter.
When you get stuck
Getting stuck is normal and is how programming is learnt. Three things help. First, read the error message slowly, from its last line. The errors section explains the common ones with examples. Second, print the values of your variables just before the line that fails. Usually one of them is not what you thought. Third, take a break. A problem that resists for an hour often falls in five minutes the next morning.
Questions people ask
Is Python hard to learn?
It is one of the easier languages to start with, because the code is short and close to English. The first three weeks feel slow for everyone. What matters is regular practice, not talent.
Can I learn Python on a phone?
You can do every lesson here on a phone with a Python app or a website that runs code. Long programs are more comfortable on a keyboard, so move to a computer when you can.
Which version of Python are these lessons for?
Python 3. The examples were run with a recent version, named at the foot of each lesson. Any version of Python 3 from the last few years will behave the same for everything taught here. Python 2 is old and no longer supported, so do not use tutorials written for it.
Do I get a certificate?
No. This site is for learning, not for certificates. What you can build is the proof.
This is an independent learning site. It is not connected with or approved by the Python Software Foundation. "Python" is a trademark of the Python Software Foundation and is used here only to name the language.