Beginner to Pro · 34 lessons · Free

Python: Zero to Hero

Bite-sized lessons of 5–10 minutes. Run the examples, crush the challenge, stack up XP: one lesson at a time, from beginner to pro.

Python progress0/34 lessons
Start learning, it's free
What is Python? Read the beginner's guide →Want to write your own code? Open the Python compiler →
  1. MODULE 1

    Python Basics

    print, variables, data types, input, operators and strings

    1. 1. Your First Python ProgramShow text on the screen with print()
    2. 2. Variables: Storing ValuesStore values in variables and use them
    3. 3. Data Types: Numbers, Text and True/FalseLearn int, float, str, bool and type()
    4. 4. input(): Asking the UserRead values from the user with input()
    5. 5. Maths with OperatorsUse + - * / // % **
    6. 6. Strings: Playing with Textf-strings, len(), upper(), lower() and indexing
  2. MODULE 2

    Making Decisions: Conditions

    if, elif, else and comparisons

    1. 1. Comparisons: True or False==, !=, >, <, >=, <= and Boolean values
    2. 2. if / else: Programs that DecideDo one thing if a condition is true, another if not
    3. 3. elif: More than Two ChoicesCheck several conditions with if, elif and else
    4. 4. and, or, not: Combining ConditionsJoin several conditions in one if
    5. 5. if inside if: Nested ConditionsMake a second decision after the first
  3. MODULE 3

    Repeating Things: Loops

    for, while, range, break and continue

    1. 1. for Loops and range()Repeat work a set number of times
    2. 2. while Loops: Repeat While TrueKeep repeating while a condition is True
    3. 3. break and continueStop a loop early or skip one round
    4. 4. Loop Patterns: Totals, Counts and ShapesLoop patterns that interviews love
  4. MODULE 4

    Collections: Lists & Dictionaries

    lists, tuples, dictionaries and sets

    1. 1. Lists: Many Values in One PlaceCreate lists, use indexes, slicing and len()
    2. 2. List Methods: Add, Remove, Sortappend, insert, remove, pop, sort, sum, max, min
    3. 3. Tuples: Lists that Don't ChangeCreate tuples, unpack them and swap values
    4. 4. Dictionaries: Names to ValuesKey-value pairs: read, add, change and loop
    5. 5. Sets: Unique Values OnlyRemove duplicates, union and intersection
  5. MODULE 5

    Functions: Reusable Code

    def, return, default arguments, recursion and lambda

    1. 1. Functions: Your Own CommandsCreate functions with def and call them
    2. 2. return: Giving Back an AnswerThe difference between print and return
    3. 3. Default & Keyword ArgumentsDefault values and arguments by name
    4. 4. Recursion: Functions that Call ThemselvesBase case and recursive case
    5. 5. lambda, sorted() and keyTiny functions and custom sorting
  6. MODULE 6

    Practical Python

    string methods, comprehensions, error handling, modules and files

    1. 1. String Methods: split, join, replaceSplit, join, clean and search text
    2. 2. List Comprehensions: Lists in One LineWrite a loop and an if in one line
    3. 3. try / except: Handling ErrorsDeal with errors without crashing
    4. 4. Modules: math, random and MoreUse Python's ready-made tools with import
    5. 5. Files: Writing and Readingopen(), with, write(), read() and readlines()
  7. MODULE 7

    Object-Oriented Programming (OOP)

    classes, objects, methods, inheritance and a mini project

    1. 1. Classes & Objects: Your Own Data Typesclass, __init__, self and attributes
    2. 2. Methods: What Objects Can DoFunctions inside a class, and __str__
    3. 3. Inheritance: Building on a ClassMake a class from another class, and super()
    4. 4. Mini Project: Report CardPut everything together in a real program