Topics / Python
Python
The most-used language in the world. Tutorials from absolute beginner to advanced.
Why learn Python?
-
Reads almost like English — the easiest mainstream language to start with.
-
The default tool for data, AI, automation, scripting, and backend services.
-
Massive standard library and the largest open-source package ecosystem on PyPI.
-
In demand for nearly every role from web developer to ML engineer to DevOps.
What you can build with Python
Web APIs with FastAPI or Django Data analysis with Pandas Machine learning and AI Automation, scripting, and glue code CLI tools and DevOps workflows
Python tutorials
45 articlesHand-written tutorials, ordered as a recommended learning path.
- 01 What is Python? A clear, professional introduction to Python — what it is, how it works, why it dominates modern software development, and what you can build with it as a beginner.
- 02 Install & First Program A step-by-step setup guide for Python 3 on Windows, macOS, and Linux. Install the interpreter, set up VS Code, and write a working Python program in under ten minutes.
- 03 Syntax & Indentation Understand Python's syntax rules, the role of indentation, statements, comments, and the most common syntax errors that trip up new developers.
- 04 Variables & Naming Learn how Python variables work, the rules and conventions for naming them, how dynamic typing changes the rules you may know from other languages, and the naming mistakes to avoid.
- 05 Data Types An overview of every built-in data type in Python — int, float, str, bool, list, tuple, dict, set, and None — with examples and guidance on when to use each.
- 06 Numbers & Math A practical guide to integers, floats, arithmetic operators, operator precedence, the math module, and the floating-point gotchas every Python beginner should know.
- 07 Strings A thorough introduction to Python strings — creation, escape sequences, indexing, slicing, the essential methods, f-strings, and why strings are immutable.
- 08 Lists A complete beginner's guide to Python lists — creation, indexing, slicing, mutation, the essential methods, iteration patterns, and a first look at list comprehensions.
- 09 Tuples A practical guide to Python tuples — creation, the single-element gotcha, packing and unpacking, methods, and when to choose a tuple over a list.
- 10 Dictionaries A complete beginner's guide to Python dictionaries — creation, access, mutation, iteration, the essential methods, and the patterns that appear in nearly every real Python program.
- 11 Sets Learn how Python sets store unique values, the operations they support — union, intersection, difference — and when to choose a set over a list or dictionary.
- 12 Type Conversion A practical guide to converting between Python types — int, float, str, bool, list, tuple, set, dict — when conversions fail, and the common pitfalls to avoid.
- 13 Conditionals A practical guide to Python conditionals — if, elif, else, truthiness, conditional expressions, and the patterns that keep branching logic clean and readable.
- 14 Comparison & Logic A complete guide to Python's comparison and logical operators — equality vs identity, chained comparisons, short-circuit evaluation, and common pitfalls.
- 15 For Loops A practical guide to Python for loops — iterating over sequences, the range function, enumerate and zip, nested loops, and the idiomatic patterns you will use every day.
- 16 While Loops A clear guide to Python while loops — condition-driven iteration, break and continue, the else clause, infinite loops, and patterns for safe, terminating code.
- 17 Functions A practical guide to Python functions — defining with def, returning values, arguments and parameters, docstrings, and the habits that make functions worth reusing.
- 18 Default & Keyword Args A practical guide to Python function arguments — defaults, keyword arguments, *args, **kwargs, positional-only and keyword-only parameters, and the mutable default gotcha.
- 19 Scope & Globals A clear guide to Python variable scope — local, enclosing, global, and built-in names, the LEGB rule, and when to reach for the global and nonlocal keywords.
- 20 Error Handling A practical guide to Python exception handling — try, except, else, finally, raising and re-raising, custom exceptions, and the habits that make error handling helpful.
- 21 File I/O A practical guide to file I/O in Python — open modes, the with statement, reading and writing text and binary, working with paths, and handling common errors.
- 22 Modules & Imports A practical guide to Python modules and imports — writing your own modules, import forms, packages, the if __name__ == '__main__' idiom, and avoiding common pitfalls.
- 23 List Comprehensions A practical guide to Python list comprehensions — syntax, filtering, nested forms, dict and set comprehensions, generator expressions, and when a plain loop is clearer.
- 24 Classes & Objects A practical introduction to Python classes — defining a class, __init__ and self, instance vs class attributes, methods, __repr__, and a first look at inheritance.
- 25 Lambda Functions A practical guide to Python lambda functions — syntax, use with sorted, map, and filter, common patterns, and the situations where a named def is the clearer choice.
- 26 Generators A practical guide to Python iterators and generators — the iterator protocol, yield, generator expressions, memory benefits, and how to model infinite sequences.
- 27 Decorators A practical introduction to Python decorators — functions as objects, wrapping, the @ syntax, functools.wraps, a logging and timing decorator, and decorators with arguments.
- 28 What Is FastAPI? A clear introduction to FastAPI — ASGI and Starlette, Pydantic-driven validation, automatic OpenAPI docs, async support, and how it compares to Flask and Django.
- 29 DataFrames Basics A practical guide to the daily DataFrame moves — read_csv and read_json, head and info, column selection, loc vs iloc, boolean filtering, sorting, and value_counts.
- 30 What Is Django? A practical introduction to Django — its newsroom origins, the batteries it ships with (ORM, admin, auth, templates), and when to pick it over FastAPI or Flask.
- 31 Routes & Pydantic A practical guide to FastAPI routing and Pydantic v2 — path operations, path/query/body parameters, model validation, response_model, and response_model_exclude_unset.
- 32 Async & Dependencies A practical guide to async path operations and Depends() in FastAPI — when async actually helps, per-request DB sessions, auth dependencies, and how sub-dependencies compose.
- 33 FastAPI + SQLAlchemy A practical guide to FastAPI with SQLAlchemy 2.0 — typed models with Mapped and mapped_column, sessionmaker, get_db dependency, CRUD endpoints, and where Alembic fits.
- 34 groupby & merge A practical guide to combining and summarising DataFrames — groupby with named aggregations, multi-column aggregates, the four merge styles, and stacking with concat.
- 35 Train/Test & Metrics Why splitting matters, how to use train_test_split with stratification, and the metrics that actually matter — accuracy, precision, recall, F1, confusion matrices, and ROC-AUC.
- 36 venv & uv Isolate your Python projects the right way — using the built-in venv module, the new uv tool, and a clear mental model for when to use pipx instead.
- 37 Packages & pip Install, pin, and publish — a practical tour of pip, PEP 621 pyproject.toml, and building a tiny library you can share on TestPyPI.
- 38 asyncio Basics A practical introduction to Python asyncio: the event loop, async/await, asyncio.run, gather, create_task, and when to pick async over threads.
- 39 Context Managers Learn how Python context managers work, how to write them with __enter__/__exit__ and contextlib, and how to use async context managers in real code.
- 40 Dataclasses A practical guide to Python dataclasses: the @dataclass decorator, field defaults, frozen instances, __post_init__, and comparisons with NamedTuple and Pydantic.
- 41 Regex Basics A practical introduction to Python regex with the re module: match, search, findall, sub, groups, named groups, raw strings, and compiling patterns for speed.
- 42 Threads vs Processes Understand the Python GIL and pick the right concurrency tool: when threads help with I/O, when processes help with CPU, and how to use concurrent.futures.
- 43 Type Hints Learn how Python type hints work in real code: annotations, Optional, Union, generics, TypedDict, Protocol, and running mypy or pyright on your project.
- 44 LangChain Basics Learn LangChain by building real components in Python: prompt templates, chains, tool calling, and memory. Practical patterns you can ship today.
- 45 OpenAI Python SDK A working tour of the OpenAI Python SDK: chat completions, streaming, structured output, embeddings, tool calls, and production-grade error handling.