Programming Academy
Learn Python one short lesson at a time: read a little, write a little code, run it, and check it. From your first print() to functions, classes, files and projects of your own.
78 lessons, about 530 minutes so far · the first 3 lessons free
78 lessons
Write your first programs: show words on the screen, ask a question, and read what Python tells you when something's wrong.
Keep values with names: numbers, text and true-or-false, and turn one kind into another.
Do maths, compare values and combine true-or-false answers.
Let your program choose what to do with if, elif and else.
Repeat instructions with for and while, without writing them again.
Work with text: pick out letters, cut it up, change it, search in it and lay it out neatly.
Keep many values in one place: add and remove them, go through them, sort and slice them, and keep pairs together in tuples.
Look things up by name with dictionaries, count with them, and keep only one of each with sets.
Name a piece of code and use it again: give it values, get an answer back, and build small tools that work together.
Functions that call themselves to solve smaller copies of a problem, and how to make sure they stop.
Make your own kinds of values, with their data and actions together: students, cricket players, bank accounts.
Read text files, pick data out of them line by line, and write new files: data that stays when the program ends.
Expect what can go wrong, catch errors before they crash your program, and raise your own when a value makes no sense.
Use the code that comes with Python, like math, random and statistics, and split your own code into modules.
Put it all together in five small real programs: a guessing game, a quiz, a password maker, a shop bill and a report card.