The Complete Python Cheat Sheet — Beginner to Pro
A comprehensive, interactive Python reference covering 26 parts — from Hello World to metaclasses — built by a developer with 20+ years of Python teaching experience. Every section is collapsible and searchable. Every code snippet is runnable in your browser via Pyodide. Includes 30+ "Common Mistake vs. Pythonic Way" comparisons, a live code editor, dark mode, and a streamer mode designed for live coding on YouTube. Covers Python 3.10–3.13 features including structural pattern matching, the walrus operator, and the new union type syntax.
Press / or Cmd+K to search · s Stream Mode · d Dark/Light · ▶ Run to execute code in-browser
Install & Run
Python 3.10+ is recommended. Download from python.org or use a version manager.
# Check version
python --version # or python3 --version
# Interactive REPL
python
# Run a script
python hello.py
# Run a module
python -m http.server 8080# pip — Python package manager
pip install requests # install
pip install requests==2.31.0 # specific version
pip install -r requirements.txt
pip list # installed packages
pip show requests # package info
pip uninstall requestsHello World & Conventions
print("Hello, World!")
print("Python", 3.12, "rocks")
name = "Alice"
print(f"Hello, {name}!")| Convention | Example | Used for |
|---|---|---|
| snake_case | user_name, get_data() | Variables, functions, modules |
| PascalCase | UserProfile, HttpClient | Classes |
| SCREAMING_SNAKE | MAX_RETRIES, API_URL | Constants |
| _single_leading | _internal_method() | Private by convention |
| __double_leading | __slots__ | Name-mangled class attrs |
Virtual Environments
# Create
python -m venv .venv
# Activate
source .venv/bin/activate # Linux/Mac
.venv\Scripts\activate # Windows PowerShell
# Deactivate
deactivate
# Modern alternative: uv (10x faster than pip)
pip install uv
uv venv
uv pip install requests# Installing packages globally
pip install flask# Always use a virtual environment
python -m venv .venv && source .venv/bin/activate
pip install flaskGlobal installs pollute your system Python and cause version conflicts across projects.