The Interactive Python Blog Tutorials.
From your first program to machine learning — learn by doing.
Variables, data types, strings, operators, and your first programs
Learn Python from scratch. Write your first Python program, understand print(), variables, and basic syntax — all running directly in your browser.
Master Python variables, data types (int, float, str, bool, None), type checking, and type conversion with hands-on examples and exercises.
Master Python integers, floats, and arithmetic operators. Learn math operations, number conversion, rounding, and real-world calculations with interactive examples.
Learn how to create, access, slice, and manipulate strings in Python. Master indexing, slicing, concatenation, and common string operations with interactive examples.
Master Python string methods: upper(), lower(), strip(), split(), join(), replace(), find(), and more. Interactive examples and exercises for every method.
Master Python string formatting with f-strings, .format(), and the % operator. Learn number formatting, alignment, and real-world formatting patterns.
Master Python booleans, comparison operators, logical operators (and, or, not), truthiness, and operator precedence with interactive examples.
Master Python print() with sep, end, and formatting. Understand input() for user interaction. Learn output patterns used in real programs.
Learn implicit and explicit type conversion in Python. Master int(), float(), str(), bool() and avoid common conversion errors.
Learn to write clean, readable Python code. Master comments, docstrings, naming conventions, and PEP 8 style guidelines that professional developers follow.
If-else, for loops, while loops, and controlling program flow
Master Python if-else statements, elif chains, nested conditions, and ternary expressions. Learn decision-making in Python with real-world examples and interactive exercises.
Master Python for loops with range(), enumerate(), zip(), and more. Learn to iterate over lists, strings, and dictionaries with interactive examples and exercises.
Learn Python while loops for condition-based repetition. Covers while syntax, counting loops, infinite loops, break, input validation, and when to use while vs for.
Master Python break, continue, and pass statements. Learn to exit loops early, skip iterations, use placeholders, and understand the for-else pattern with examples.
Master Python nested loops for working with grids, combinations, and multi-dimensional data. Learn patterns, understand O(n²) performance, and know when to avoid them.
Learn to read Python tracebacks and fix common errors: SyntaxError, NameError, TypeError, IndexError, ValueError, and more. Stop fearing error messages and start using them.
Lists, tuples, dictionaries, sets, and complex data handling
Learn everything about Python lists — how to create, access, modify, sort, and loop through them with practical examples and exercises.
Master Python comprehensions — list, dict, set, and generator expressions. Transform loops into elegant one-liners with filtering, mapping, and conditional logic.
Master Python tuples — immutable sequences for fixed data. Learn tuple creation, packing, unpacking, indexing, when to use tuples vs lists, and real-world patterns.
Master Python dictionaries — create, access, modify, and loop through key-value pairs. Learn dict methods, nested dicts, and real-world patterns with interactive examples.
Master Python sets — unique, unordered collections. Learn set creation, operations (union, intersection, difference), methods, and real-world deduplication patterns.
Master Python slicing with start:stop:step notation. Learn to extract portions of strings, lists, and tuples, reverse sequences, and use negative indices.
Master Python unpacking — assign multiple values at once, swap variables, use starred expressions (*), and destructure nested data structures.
Master Python sorting with sort(), sorted(), reverse parameter, key functions, and lambda-based custom sorting. Learn to sort any data the way you need.
Learn to work with nested Python data: lists of dicts, dicts of lists, JSON-like structures. Master accessing, modifying, and iterating through complex data.
Understand Python\
Define functions, arguments, scope, recursion, and higher-order functions
Learn to define and call Python functions, use parameters and return values, understand scope basics, and write reusable code with real-world examples.
Master Python function arguments — positional, keyword, default values, *args, **kwargs. Learn flexible function signatures used in real Python libraries.
Master Python lambda functions — anonymous one-line functions. Learn lambda syntax, use with sorted(), map(), filter(), and know when regular functions are better.
Understand Python variable scope — local, enclosing, global, built-in (LEGB). Learn closures, the global and nonlocal keywords, and avoid common scope bugs.
Master Python recursion — understand the call stack, base cases, and recursive patterns. Learn factorial, Fibonacci, and real-world recursive algorithms.
Master Python\
Try-except, custom exceptions, context managers, and logging
Master Python error handling with try-except. Learn to catch exceptions, use else and finally blocks, handle multiple exceptions, and write robust code that doesn\
Learn to create custom Python exception classes. Build meaningful error hierarchies, add context to errors, and write professional error handling patterns.
Learn how Python context managers work with the with statement. Build your own context managers using classes and contextlib, and master automatic resource cleanup.
Learn Python\
Imports, packages, virtual environments, and publishing to PyPI
Learn how Python\
Learn how to create Python packages with __init__.py, organize modules into folders, and use relative vs absolute imports — with runnable examples and practice exercises.
Learn how to create Python virtual environments with venv, install packages with pip, manage dependencies with requirements.txt, and keep your projects isolated.
Learn how to package your Python project with pyproject.toml, build distributions, upload to PyPI, and manage versions — with runnable examples and practice exercises.
Read and write files, CSV, JSON, and pathlib
Learn to read, write, and process files in Python. Master open(), read(), write(), file modes, and the with statement through interactive examples and exercises.
Learn to read, write, and process CSV files in Python using the csv module. Master csv.reader, csv.writer, DictReader, and DictWriter through interactive examples.
Learn to parse, create, and manipulate JSON data in Python. Master json.loads(), json.dumps(), file I/O, and pretty printing through interactive examples and exercises.
Learn modern file path handling in Python with pathlib. Master Path objects, path properties, joining paths, and globbing through interactive examples and exercises.
Classes, inheritance, magic methods, dataclasses, and design patterns
Learn Python classes and objects from scratch. Understand __init__, self, instance methods, class attributes, and __str__ with interactive examples and exercises.
Master Python inheritance — create subclasses, override methods, use super(), and understand polymorphism with interactive code examples and exercises.
Learn the difference between @classmethod and @staticmethod in Python. Master factory methods, utility functions, and when to use each decorator with hands-on exercises.
Master Python @property decorator to create getters, setters, deleters, and computed attributes with validation. Learn encapsulation through hands-on exercises.
Master Python magic methods (dunder methods) including __str__, __repr__, __len__, __eq__, __lt__, __getitem__, __contains__, and __call__ with interactive exercises.
Learn Python operator overloading with __add__, __sub__, __mul__, __eq__, __radd__, and __iadd__. Build custom classes that work with arithmetic and comparison operators.
Learn how to use Python\
Understand Python multiple inheritance, the diamond problem, Method Resolution Order (MRO), super() in complex hierarchies, and practical mixin patterns.
Master Python dataclasses to eliminate repetitive __init__, __repr__, and __eq__ boilerplate. Learn @dataclass, field(), __post_init__, frozen classes, and comparison.
Learn when to use NamedTuple, TypedDict, or dataclass in Python. Compare structured data containers with interactive examples and exercises.
Learn how __slots__ works in Python to reduce memory usage and speed up attribute access. Interactive examples with memory comparisons.
Master advanced dataclass features including validation with __post_init__, immutability with frozen, complex defaults with field(), and dataclass inheritance patterns.
Learn when to use composition over inheritance in Python. Understand has-a vs is-a relationships, dependency injection, and how to refactor fragile inheritance hierarchies.
pytest, mocking, fixtures, and test-driven development
Learn how to write Python tests using pytest-style conventions. Master assert statements, test functions, edge cases, and test organization with interactive exercises.
Learn how to use mocking and test fixtures to test Python code that depends on databases, APIs, and file systems. Master dependency injection and test isolation.
Learn Test-Driven Development (TDD) in Python. Master the Red-Green-Refactor cycle, build a FizzBuzz solution step by step, and understand when TDD shines.
collections, itertools, functools, datetime, regex, and more
Master Python\
Master Python\
Master Python\
Master Python\
Python Regular Expressions: Pattern Matching from Basics to Advanced — interactive tutorial with runnable examples and practice exercises.
Python Enums: Type-Safe Constants for Cleaner Code — interactive tutorial with runnable examples and practice exercises.
Python SQLite: Build and Query Databases Without a Server — interactive tutorial with runnable examples and practice exercises.
Iterators, generators, decorators, type hints, async, and internals
Python Iterators: How for Loops Really Work Under the Hood — interactive tutorial with runnable examples and practice exercises.
Python Generators: Process Millions of Items Without Running Out of Memory — interactive tutorial with runnable examples and practice exercises.
Python Decorators Explained: A Step-by-Step Guide — interactive tutorial with runnable examples and practice exercises.
Python Type Hints: Add Types, Generics, and the typing Module — interactive tutorial with runnable examples and practice exercises.
Python Protocols: Duck Typing with Type Safety — interactive tutorial with runnable examples and practice exercises.
Python Pydantic: Validate Data Like a Pro — interactive tutorial with runnable examples and practice exercises.
15 Python Pitfalls That Trip Up Even Experienced Developers — interactive tutorial with runnable examples and practice exercises.
Python Threading vs Multiprocessing vs asyncio: When to Use What — interactive tutorial with runnable examples and practice exercises.
Python Async/Await: Write Non-Blocking Code from Scratch — interactive tutorial with runnable examples and practice exercises.
Python Design Patterns: Factory, Strategy, Observer, and More — interactive tutorial with runnable examples and practice exercises.
How Python Works Under the Hood: Memory, GIL, and Bytecode — interactive tutorial with runnable examples and practice exercises.
Build Command-Line Tools with argparse and sys.argv — interactive tutorial with runnable examples and practice exercises.
Metaclasses, descriptors, __new__, and dynamic attribute access
Python Metaclasses: Control How Classes Are Created — interactive tutorial with runnable examples and practice exercises.
Python Descriptors: The Secret Behind @property and ORM Fields — interactive tutorial with runnable examples and practice exercises.
__init__ vs __new__: What Actually Happens When You Create an Object — interactive tutorial with runnable examples and practice exercises.
__getattr__ and __setattr__: Dynamic Attribute Access in Python — interactive tutorial with runnable examples and practice exercises.
NumPy, Pandas, Matplotlib, SciPy, and scikit-learn
NumPy Arrays: Create, Index, Slice, and Reshape — interactive tutorial with runnable examples and practice exercises.
NumPy Operations: Element-wise Math, Aggregations, and ufuncs — interactive tutorial with runnable examples and practice exercises.
NumPy Broadcasting: Operate on Arrays of Different Shapes — interactive tutorial with runnable examples and practice exercises.
NumPy Linear Algebra: Dot Products, Inverses, and Eigenvalues — interactive tutorial with runnable examples and practice exercises.
Pandas: Create, Load, and Explore DataFrames — interactive tutorial with runnable examples and practice exercises.
Pandas Indexing: loc, iloc, Boolean Indexing, and Selection — interactive tutorial with runnable examples and practice exercises.
Pandas Data Cleaning: Missing Values, Duplicates, and Outliers — interactive tutorial with runnable examples and practice exercises.
Pandas merge(), join(), concat(): Combine DataFrames Like SQL — interactive tutorial with runnable examples and practice exercises.
Pandas GroupBy: Split-Apply-Combine for Powerful Aggregations — interactive tutorial with runnable examples and practice exercises.
Pandas apply(), map(), transform(): Custom Data Transformations — interactive tutorial with runnable examples and practice exercises.
Pandas String and DateTime Operations for Real-World Data — interactive tutorial with runnable examples and practice exercises.
Pandas Pivot Tables and Cross-Tabulation for Business Analysis — interactive tutorial with runnable examples and practice exercises.
Matplotlib: Create Line, Bar, Scatter, and Pie Charts — interactive tutorial with runnable examples and practice exercises.
Advanced Matplotlib: Subplots, Dual Axes, Styles, Annotations — interactive tutorial with runnable examples and practice exercises.
Data Visualization: Choose the Right Chart and Tell a Story — interactive tutorial with runnable examples and practice exercises.
SciPy Statistics: Distributions, Hypothesis Tests, and Correlations — interactive tutorial with runnable examples and practice exercises.
Build Your First ML Model: Linear Regression with scikit-learn — interactive tutorial with runnable examples and practice exercises.
Python Classification: Build a Classifier with scikit-learn — interactive tutorial with runnable examples and practice exercises.
Evaluating ML Models: Cross-Validation, Metrics, and Overfitting — interactive tutorial with runnable examples and practice exercises.
K-Means Clustering: Find Patterns in Data Without Labels — interactive tutorial with runnable examples and practice exercises.
Build real-world projects: pipelines, dashboards, and ML applications
Build an Automated Data Cleaning Pipeline — interactive tutorial with runnable examples and practice exercises.
Build a Sales Performance Dashboard with KPI Analysis — interactive tutorial with runnable examples and practice exercises.
Build a Budget Tracker and Expense Analyzer — interactive tutorial with runnable examples and practice exercises.
Build a Log File Parser That Finds Errors and Patterns — interactive tutorial with runnable examples and practice exercises.
Predict Customer Churn: End-to-End Data Analysis (with sklearn) — interactive tutorial with runnable examples and practice exercises.
Build an Inventory Management System with SQLite — interactive tutorial with runnable examples and practice exercises.
Time Series: Detect Trends and Anomalies in Business Data — interactive tutorial with runnable examples and practice exercises.
Build a Simple ETL Pipeline: Extract, Transform, Load — interactive tutorial with runnable examples and practice exercises.