Skip to Content
Skip to content
PROGRAMMING

Python Tutorials

Standalone Python tutorials built around concrete bugs, performance traps, and everyday scripting tasks. Jump straight to guides on fixing ModuleNotFoundError, avoiding mutable default arguments, reading 10 GB logs line by line, auditing rejected CSV rows, and batching requests with asyncio.gather.

Each tutorial opens with a minimal script and its exact stdout or traceback output, followed by the fix and common mistakes to avoid.

Python
Python f-Strings: Print Things People Can Actually Read Level: Beginner

If a person reads your output, format it. f-strings let you mix text and values, round numbers, add thousands separators and line up a table, with very little code.

Python
Python Lists in 15 Minutes: Add, Remove, Loop, Done Level: Beginner

The four list moves you need on day one: make a list, add to it, remove from it, and loop over it. Plus the one mistake that gives wrong results without any error. Nothing more.

Python
Fix pip Installing Into the Wrong Python Environment Level: Intermediate

Reproduce an interpreter mismatch, compare executable, pip and module paths, then verify the repair from the Python environment that runs the application.

Python
Audit Rejected CSV Rows and Reconcile Every Input Record Level: Intermediate

Validate a defined spreadsheet-export contract, record rejected rows with reasons and line ranges, and reconcile accepted and rejected outputs without changing the source.

Python
Python Dictionary Comprehensions: When They Help and When They Hurt Level: Intermediate

A dictionary comprehension builds a dictionary in one line. Good for transforming, filtering and building lookups.

Python
Python Decorators Explained With One Real Example Level: Advanced

A decorator is just a function that wraps another function. Build a real timing decorator step by step: functions as values, the wrapper, the @ syntax, and functools.wraps.

Python
Running Many Requests at Once With asyncio.gather Level: Advanced

asyncio.gather runs many waiting tasks at once in one thread and returns results in order.

Python
Test a Python Wheel Outside the Source Repository Level: Advanced

Catch a missing package resource by inspecting a wheel and testing its import, version, data file and console command in a clean environment.

Python
Python try/except: Catch the Error You Expect, Not Every Error Level: Beginner

A bare except hides typos and real bugs behind wrong results. Catch the specific error you expect, keep the try block small, and let everything else crash where you can see it.