Python lessons from zero
Each lesson has 10 parts: objectives, why learn it, concept, syntax, example, line-by-line explanation, common mistakes, auto-graded practice, quick quiz and summary.
(published, total) => `${published} of ${total} lessons are currently available in English. The remaining English translations are being reviewed before publication. All lessons are available in Vietnamese.` Bài học tiếng Việt.
Stage 1: Foundations
From your first print to lists. Free for everyone.
- Python Basics: Print and Variables
Learn Python from zero: print your first line and store values in variables. - Variables and data types
What a variable is, how to name variables, the four basic data types int, float, str, bool, and the type() function. - Reading input with input()
Read what the user types with input(), convert strings to numbers with int() and float(), and the / and // operators. - Conditional statements if / elif / else
Let a program make decisions: comparisons, if, elif, else, the and/or/not operators and indentation rules. - for and while loops
Repeat work with for and range(), while, running totals, break and continue. - Lists
Store many values in one variable: creating lists, indexes, append, len, looping over a list, sum, max, min, split().
Stage 2: Practical Python
Advanced functions, dicts, error handling, object-oriented programming. For Pro members.
- Functions: default parameters, returning several values Pro
Write your own functions with def, return, default parameters, keyword arguments, returning several values (a tuple) and variable scope. - Dictionaries (dict) and sets Pro
Store data by key with dict, count frequencies, loop with items(), get(); remove duplicates with set. - Handling errors with try / except Pro
Catch errors while a program runs: try, except ValueError, ZeroDivisionError, else, finally and raise. - Object-oriented programming: classes Pro
Create a class, the __init__ constructor, attributes, methods, self, __str__ and creating several objects.