Skip to content
DevTrail

Learn Python from Basic to Advanced

A friendly language for scripts, data and backends.

modules
14
topics
75
exercises
267
of practice
43 h 5 min

About this course

Learn Python from the fundamentals to advanced topics: data types, control flow, functions, collections, OOP, exceptions, files, iterators and generators, decorators, typing, async and testing. Python runs in your browser with Pyodide.

What you'll learn

14 modules and 75 topics. Every topic has short lessons, a quiz, hands-on exercises checked in your browser, and interview questions.

  1. 1Introduction to Python

    What Python is, installing it, running code and your first program.

    • What Is Python?
    • Installing Python, the REPL and Scripts
    • Your First Python Program
    • Comments and Indentation
    • Module 1 assessment
  2. 2Variables and Data Types

    Variables, numbers, strings, booleans, None, type conversion and input/output.

    • Variables and Naming
    • Numbers and Arithmetic Operators
    • Strings, Booleans and None
    • Type Conversion, input() and f-strings
    • Module 2 assessment
  3. 3Conditions and Loops

    if/elif/else, match, for and while loops, break/continue and range.

    • if, elif and else
    • Truthiness, One-line ifs and match
    • for Loops and range()
    • while Loops, break, continue and Loop else
    • Module 3 assessment
  4. 4Functions

    Defining functions, arguments, defaults, *args/**kwargs, scope, lambdas and recursion.

    • Defining Functions: def, Parameters and return
    • Arguments: Keywords, Defaults, *args and **kwargs
    • Scope: Local, Global and the LEGB Rule
    • Lambdas, Higher-Order Functions and Recursion
    • Module 4 assessment
  5. 5Lists, Tuples, Sets and Dicts

    Core collections, slicing, comprehensions and choosing the right one.

    • Lists
    • Tuples and Sets
    • Dictionaries
    • List, Dict and Set Comprehensions
    • Choosing Collections and Mutability Pitfalls
    • Module 5 assessment
  6. 6Working with Strings

    String methods, f-strings, formatting and common text tasks.

    • Strings, Indexing and Slicing
    • Essential String Methods
    • split, join and Text Processing
    • f-strings and Formatting in Depth
    • Module 6 assessment
  7. 7Object-Oriented Python

    Classes, objects, __init__, methods, inheritance, dunder methods and dataclasses.

    • Classes, Objects and __init__
    • Class vs Instance Attributes, @classmethod and @staticmethod
    • Inheritance, super() and Composition
    • Dunder (Magic) Methods
    • Encapsulation and @property
    • Dataclasses
    • Module 7 assessment
  8. 8Exceptions

    try/except/else/finally, raising and custom exceptions.

    • Exceptions and try/except
    • else and finally
    • Raising and Re-raising Exceptions
    • Custom Exceptions and Hierarchies
    • EAFP vs LBYL and Best Practices
    • Module 8 assessment
  9. 9Modules, Packages and Files

    Imports, packages, virtual environments, pip, reading and writing files, JSON and CSV.

    • Modules and Imports
    • Packages, pip, uv and Virtual Environments
    • Reading and Writing Text Files
    • Working with JSON and CSV
    • Module 9 assessment
  10. 10Iterators, Generators and Decorators

    The iterator protocol, generators, yield, context managers and decorators.

    • Iterators and Iterables
    • Generators and yield
    • Context Managers and the with Statement
    • Decorators: The Basics
    • Decorators with Arguments, Stacking and Caching
    • Module 10 assessment
  11. 11Type Hints

    Type hints, typing module, generics and checking with mypy.

    • What Are Type Hints?
    • Collections, Optional and Union Types
    • Callable, Literal, TypedDict and Protocol
    • Generics, Type Aliases and mypy
    • Module 11 assessment
  12. 12Async Python

    async/await, the event loop, asyncio tasks and when async helps.

    • Why Async? The Event Loop Explained
    • Coroutines and await
    • Running Things Together: gather, Tasks and Timeouts
    • Async vs Threads vs Processes, Semaphores and Queues
    • Module 12 assessment
  13. 13Testing with pytest

    Writing tests, fixtures, parametrize and mocking.

    • Your First Tests with pytest
    • Fixtures: Reusable Test Setup
    • Parametrize: Many Cases, One Test
    • Mocking with unittest.mock
    • Module 13 assessment
  14. 14Python Projects

    Guided projects that combine everything.

    • Project 1: To-do List Logic
    • Project 2: Bank Account System
    • Project 3: Inventory Manager
    • Project 4: Terminal Quiz Game
    • Project 5: Log Analyzer