Beginner to Advanced · Complete Roadmap

Learn Python
From Zero to Production

A structured path through every stage of Python — from running your first script to building real applications, working with data, and shipping to the web. Follow in order or jump to where you are.

Stage 1–3 · Foundations Stage 4–6 · Core Skills Stage 7–8 · Applied Python Stage 9–10 · Advanced
1

Getting Started

Foundations

Before writing real code you need Python installed and a mental model of what the language is. This stage takes about a weekend.

What is Python?
  • Interpreted vs compiled languages
  • Why Python: readable syntax, huge ecosystem
  • Where Python is used: web, data, AI, scripting
  • CPython, PyPy — what runs your code
Read the guide
Installation and Setup
  • Install Python 3 on Windows / macOS / Linux
  • The Python REPL — interactive exploration
  • VS Code setup: Python extension, linter, formatter
  • Running your first .py file
Read the guide
Virtual Environments
  • Why isolate dependencies per project
  • python -m venv env and activating it
  • pip: installing and listing packages
  • requirements.txt — freeze and restore
Coming soon
# Your first Python script print("Hello, World!") name = input("What's your name? ") print(f"Welcome to Python, {name}!")
2

Core Language

Foundations

The building blocks every Python program is made of. Master these before moving on — everything else builds on them.

Variables and Data Types
  • int, float, complex
  • str — string creation and immutability
  • boolTrue / False and truthiness
  • Dynamic typing and type()
  • Type casting: int(), str(), float()
Read the guide
Operators and Expressions
  • Arithmetic: + - * / // % **
  • Comparison: == != > < >= <=
  • Logical: and or not
  • Bitwise: & | ^ ~ << >>
  • Identity: is / is not — vs ==
  • Membership: in / not in
Read the guide
Control Flow
  • if / elif / else
  • Ternary expression: x if cond else y
  • for loops and range()
  • while loops
  • break, continue, pass
  • for … else and while … else
Read the guide
Strings in Depth
  • Indexing and slicing: s[1:5:2]
  • f-strings and format()
  • Common methods: .split(), .join(), .strip(), .replace()
  • Multi-line strings and raw strings
  • String immutability
Read the guide
3

Data Structures

Foundations

Python's built-in data structures are some of its greatest strengths. Understanding when to use each one is fundamental to writing clean code.

Lists
  • Creating, indexing, slicing
  • .append(), .extend(), .insert(), .pop(), .remove()
  • Sorting: .sort() vs sorted()
  • List comprehensions: [x*2 for x in nums if x>0]
  • Nested lists and 2D arrays
Read the guide
Tuples and Sets
  • Tuples — immutable sequences, packing/unpacking
  • When to use tuple over list
  • Sets — unique unordered elements
  • Set operations: union, intersection, difference
  • Frozensets
Read the guide
Dictionaries
  • Key-value pairs, hashing
  • .get(), .keys(), .values(), .items()
  • Dict comprehensions
  • Nested dictionaries
  • defaultdict, Counter, OrderedDict
Read the guide
Advanced Collections
  • collections module: deque, namedtuple
  • Stack and queue patterns using lists
  • Choosing the right structure: time complexity
  • Memory efficiency considerations
Coming soon
# Comprehensions — one of Python's best features squares = [x**2 for x in range(10)] even_sq = {x**2 for x in range(10) if x % 2 == 0} word_len = {word: len(word) for word in ["python", "is", "great"]}
4

Functions and Modules

Core Skills

Functions are Python's primary unit of code reuse. This stage also covers how Python organises code across files and packages.

Defining Functions
  • def and return
  • Positional, keyword, default arguments
  • *args and **kwargs
  • Docstrings and help()
  • Type hints: def add(a: int, b: int) -> int
Read the guide
Scope and Closures
  • LEGB rule: Local, Enclosing, Global, Built-in
  • global and nonlocal keywords
  • Closures and factory functions
  • Why closures matter for callbacks and decorators
Coming soon
Lambda and Higher-Order Functions
  • Anonymous functions: lambda x: x*2
  • map(), filter(), reduce()
  • Functions as first-class objects
  • Passing functions as arguments
Coming soon
Modules and Packages
  • import, from … import, as
  • __name__ == "__main__" guard
  • Creating your own module
  • Package structure: __init__.py
  • Standard library highlights: os, sys, math, datetime, random
Coming soon
Milestone
At this point you can write real, useful scripts. A good project: a command-line to-do list that reads and writes a JSON file. It will touch functions, dictionaries, file I/O, and modules all at once.
5

Object-Oriented Programming

Core Skills

OOP organises code around objects — bundles of data and behaviour. Python's OOP is flexible and less ceremonial than Java or C++.

Classes and Objects
  • class keyword, __init__
  • Instance vs class attributes
  • self — what it is and why
  • Instance methods, class methods, static methods
  • __repr__ and __str__
Read the guide
The Four Pillars in Python
  • Encapsulation: _private and __name_mangling
  • Inheritance: class Dog(Animal)
  • Polymorphism: duck typing and method overriding
  • Abstraction: abc module, @abstractmethod
  • super() and MRO (Method Resolution Order)
Read the guide
Dunder Methods
  • __len__, __getitem__, __setitem__
  • Operator overloading: __add__, __eq__
  • Context managers: __enter__ / __exit__
  • Making your class iterable: __iter__ / __next__
Coming soon
Dataclasses and Enums
  • @dataclass — auto-generate __init__, __repr__
  • field(), frozen=True
  • Enum — named constants
  • When to use dataclass vs namedtuple vs dict
Coming soon
from dataclasses import dataclass @dataclass class Student: name: str gpa: float def is_passing(self) -> bool: return self.gpa >= 2.0 s = Student("Arj", 3.8) print(s) # Student(name='Arj', gpa=3.8) print(s.is_passing()) # True
6

File Handling, Errors and Testing

Core Skills

Real programs read and write files, fail gracefully, and have tests to prove they work correctly. These three skills together make your code production-ready.

File Handling
  • open() modes: r, w, a, rb
  • Context manager: with open(...) as f
  • Reading: .read(), .readline(), .readlines()
  • Writing and appending
  • Working with pathlib.Path
  • CSV: csv module and DictReader/DictWriter
  • JSON: json.load() / json.dump()
Read the guide
Data Storage
  • Files vs databases — when each makes sense
  • SQLite with sqlite3
  • ORMs: intro to SQLAlchemy
  • Pickle and shelve for Python objects
  • Environment variables and .env files
Read the guide
Exception Handling
  • try / except / else / finally
  • Built-in exceptions: ValueError, TypeError, KeyError, FileNotFoundError
  • Raising exceptions: raise
  • Custom exception classes
  • Exception chaining: raise X from Y
Coming soon
Testing
  • Why test? — catching regressions early
  • unittest — standard library test framework
  • pytest — simpler syntax, fixtures, parametrize
  • Writing assertions: assert keyword
  • Mocking with unittest.mock
  • Test-driven development (TDD) basics
Coming soon
7

Applied Python: Data and NumPy

Applied Python

Python dominates data work. NumPy is the foundation for nearly every data-science and machine-learning library in the ecosystem.

NumPy Essentials
  • Why NumPy: vectorised operations, no loops
  • np.array(), np.zeros(), np.ones(), np.arange()
  • Shape, dtype, ndim, reshape
  • Indexing, slicing, boolean masking
  • Broadcasting rules
  • Universal functions (ufuncs)
  • Stacking and splitting arrays
Read the guide
Pandas
  • Series and DataFrame
  • Reading: pd.read_csv(), read_json(), read_excel()
  • Selecting data: .loc, .iloc
  • Filtering, groupby, merge, pivot
  • Handling missing data: .dropna(), .fillna()
  • Apply and vectorised string operations
Coming soon
Visualisation
  • Matplotlib: line, bar, scatter, histogram
  • Subplots and figure layout
  • Seaborn for statistical plots
  • Plotly for interactive charts
  • Saving figures to PNG/SVG
Coming soon
Regular Expressions
  • re.match(), re.search(), re.findall()
  • Character classes, quantifiers, groups
  • Named groups: (?P<name>...)
  • Substitution: re.sub()
  • Compiling patterns for performance
Coming soon
import numpy as np a = np.array([1, 2, 3, 4, 5]) print(a * 2) # [2 4 6 8 10] — no loop needed print(a[a > 2]) # [3 4 5] — boolean masking print(a.mean(), a.std()) # 3.0 1.41...
8

Applied Python: Computer Vision

Applied Python

One of Python's most exciting application areas. These tutorials walk you through building a face recognition system from scratch — a real project that touches NumPy, OpenCV, and dlib together.

OpenCV
  • Installing: pip install opencv-python
  • Reading, displaying, and saving images
  • Colour spaces: BGR, RGB, grayscale, HSV
  • Drawing on images: rectangles, text, circles
  • Resizing, cropping, flipping
  • Thresholding and edge detection (Canny)
Read the guide
Live Camera Feed
  • cv2.VideoCapture(0)
  • Frame-by-frame processing loop
  • Displaying real-time output
  • Recording video to file
  • Performance: frame rate and resolution
Read the guide
Face Detection with dlib
  • What dlib is and when to use it over OpenCV
  • HOG-based face detector
  • 68-point facial landmark predictor
  • Face alignment for recognition accuracy
  • CNN face detector (more accurate, GPU optional)
Read the guide
Face Recognition System
  • face_recognition library: encoding faces
  • Comparing encodings: Euclidean distance
  • Building a known-faces database
  • Real-time identification from webcam
  • Full project walkthrough (4 phases)
Read the roadmap
face_recognition Library
  • face_recognition.load_image_file()
  • face_encodings() — 128-d vector per face
  • compare_faces() and face_distance()
  • Batch processing a directory of images
  • Tolerance tuning for accuracy vs false positives
Read the guide
9

Advanced Language Features

Advanced

These are the features that separate good Python from excellent Python — the tools experienced developers reach for every day.

Iterators and Generators
  • Iterator protocol: __iter__ / __next__
  • yield — turning a function into a generator
  • Generator expressions: (x*2 for x in range(n))
  • itertools: chain, islice, product, groupby
  • Lazy evaluation and memory efficiency
  • yield from — delegating to sub-generators
Coming soon
Decorators
  • What a decorator is: a function wrapping a function
  • Writing your first decorator
  • functools.wraps — preserve metadata
  • Decorators with arguments
  • Class-based decorators
  • Built-in: @property, @staticmethod, @classmethod, @cache
Coming soon
Context Managers
  • with statement — resource management
  • Writing one with __enter__ / __exit__
  • contextlib.contextmanager with yield
  • Nested context managers
  • Use cases: files, locks, database transactions
Coming soon
Concurrency
  • The GIL — what it is and what it limits
  • Threading: threading.Thread, locks, race conditions
  • Multiprocessing: bypassing the GIL with multiprocessing
  • Async/await: asyncio, coroutines, event loop
  • concurrent.futures: ThreadPoolExecutor, ProcessPoolExecutor
  • When to use which: I/O-bound vs CPU-bound
Coming soon
Type System and Protocols
  • Full type hint syntax: Union, Optional, TypeVar
  • typing.Protocol — structural subtyping
  • Generic classes: list[int], dict[str, float]
  • Running mypy for static analysis
  • typing.overload for function signatures
Coming soon
Metaprogramming
  • Metaclasses and type()
  • __slots__ for memory optimisation
  • Descriptors: __get__, __set__, __delete__
  • getattr / setattr / hasattr / delattr
  • inspect module — introspection at runtime
Coming soon
# A decorator that times any function import time, functools def timer(func): @functools.wraps(func) def wrapper(*args, **kwargs): start = time.perf_counter() result = func(*args, **kwargs) end = time.perf_counter() print(f"{func.__name__} ran in {end - start:.4f}s") return result return wrapper @timer def slow_task(): time.sleep(0.5)
10

Production Python and Web

Advanced

The final stage — packaging your work, shipping to the web, and building on the ecosystem of frameworks that make Python a professional-grade tool.

Web Frameworks
  • Flask: routes, templates (Jinja2), request/response
  • FastAPI: async routes, auto docs, Pydantic validation
  • Django: ORM, admin, migrations, auth (full-stack)
  • Choosing: Flask for minimal APIs, FastAPI for performance, Django for full apps
  • REST API design fundamentals
Coming soon
HTTP Requests and APIs
  • requests: GET, POST, headers, auth, params
  • Handling responses: status codes, JSON parsing
  • httpx for async HTTP
  • API keys and OAuth basics
  • Rate limiting and retry logic
  • Web scraping with BeautifulSoup and Playwright
Coming soon
Packaging and Distribution
  • pyproject.toml — modern project config
  • Building with build and publishing to PyPI
  • Semantic versioning
  • CLI tools: argparse, click, typer
  • Logging: logging module, handlers, formatters
Coming soon
Deployment
  • Docker: containerising a Python app
  • WSGI vs ASGI: Gunicorn, Uvicorn
  • Render, Railway, Fly.io — free-tier hosting
  • Environment variables and secrets management
  • Basic CI/CD: GitHub Actions to auto-deploy
Coming soon
Machine Learning Entry Point
  • scikit-learn: classification, regression, clustering
  • Train/test split, cross-validation, metrics
  • TensorFlow and PyTorch — when you need deep learning
  • Jupyter notebooks for exploration
  • Hugging Face — using pre-trained models
Coming soon
You made it
Completing this roadmap puts you in the top tier of Python developers. The best next step is to build something real — a web API, a data pipeline, a CLI tool — and deploy it publicly. Projects beat certificates every time.
Complete Notes

Want everything in one place? The full notes cover Stages 1–6 end to end with examples and exercises.

Scroll to Top