Python lessons from zero
Each lesson has 10 parts: objectives, why learn it, concept, syntax, example, line-by-line walkthrough, common mistakes, auto-graded practice, quick quiz and summary.
Stage 1: Foundations
From your first print command 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 division / and //. - Conditionals: if / elif / else
Let a program decide: comparisons, if, elif, else, and/or/not operators and indentation rules. - for and while loops
Repeat work with for and range(), while, accumulation, break and continue. - Lists
Store many values in one variable: create lists, indices, append, len, loop over lists, sum, max, min, split().
Stage 2: Real-world Python
Advanced functions, dict, error handling, object-oriented programming. For Pro members.
- Functions: default parameters, multiple return values Pro
Write your own functions with def, return, default parameters, keyword arguments, multiple return values (tuples) and variable scope. - Dictionaries (dict) and sets Pro
Store data by key with dict, count frequencies, loop over items(), get(); remove duplicates with set. - Error handling with try / except Pro
Catch errors while a program runs: try, except ValueError, ZeroDivisionError, else, finally and raise. - Object-oriented programming: class Pro
Create classes, the __init__ constructor, attributes, methods, self, __str__, and many objects.