Python Lab

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.

  1. Python Basics: Print and Variables
    Learn Python from zero: print your first line and store values in variables.
  2. 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.
  3. Reading input with input()
    Read what the user types with input(), convert strings to numbers with int() and float(), and the / and // operators.
  4. Conditional statements if / elif / else
    Let a program make decisions: comparisons, if, elif, else, the and/or/not operators and indentation rules.
  5. for and while loops
    Repeat work with for and range(), while, running totals, break and continue.
  6. 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.

  1. 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.
  2. Dictionaries (dict) and sets Pro
    Store data by key with dict, count frequencies, loop with items(), get(); remove duplicates with set.
  3. Handling errors with try / except Pro
    Catch errors while a program runs: try, except ValueError, ZeroDivisionError, else, finally and raise.
  4. Object-oriented programming: classes Pro
    Create a class, the __init__ constructor, attributes, methods, self, __str__ and creating several objects.

Create a free account to practise