PyPython Lab

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.

  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 division / and //.
  4. Conditionals: if / elif / else
    Let a program decide: comparisons, if, elif, else, and/or/not operators and indentation rules.
  5. for and while loops
    Repeat work with for and range(), while, accumulation, break and continue.
  6. 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.

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

Create a free account to practice