Everyone Can Learn Program
中文 Start learning
Course 2 · Python Basics Free to read

Python from Zero tutorial

Seven stages from your first print() to your own functions, ending with a graduation challenge.

14 lessonsabout 14 h

Then continue with: Data Structures and Algorithms, Computer Networks, Operating Systems, Backend Development, Software Testing, Cyber Security Basics, AI Foundations, System Design

Learn it by doing

The interactive course has the same lessons with an editor next to them: run every example, answer the quizzes and solve exercises that are checked the moment you submit. Free to start, no sign-up.

Start the interactive course
1

Hello, Python

Print, calculate and read error messages.
1 print() and calculationsHow do you make Python show something, and how does it calculate?2 Reading error messagesWhat do you do when Python says something is wrong?
2

Variables and types

Remember values and read what the user types.
3 VariablesHow does a program remember things?4 Types and input()Why does "3" + "4" give 34, and how do you read what the user types?
3

Strings

Work with text.
5 Indexing and slicingHow do you get a single letter, or a piece, out of a string?6 String methods and f-stringsHow do you change, search and format text easily?
4

Decisions

Make the program choose.
7 if and elseHow does a program choose between two paths?8 elif, and, or, notWhat if there are more than two choices, or several conditions at once?
5

Loops

Repeat with for and while.
9 for and range()How do you repeat code for a range of numbers, or for each letter?10 while loopsHow do you loop until something happens, when you can't know the count in advance?
6

Lists

Store many values in one place.
11 List basicsHow do you keep many values together under one name?12 Working with listsHow do you answer questions about a whole list: biggest, average, which ones match?
7

Functions

Build your own tools, then graduate.
13 def, parameters and returnHow do you build your own reusable tools that take inputs and give back results?14 Graduation challengeCan you combine everything you've learned into one real program?