Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Python

PythonΒΆ


πŸ“¦ Installation

Mac OS

brew install python

Linux

sudo apt update
sudo apt install python3
⚑ Hello World
print("Hello World!)
πŸ”€ Data Types & Variables

Core types

x = 69          # int
y = 3.14        # float
name = "Ada"    # str
flag = True     # bool
nothing = None  # NoneType

Collections

nums = [1, 2, 3]                # list (mutable)
coords = (10, 20)               # tuple (immutable)
unique = {1, 2, 3}              # set (unique items)
user = {"name": "Ada", "id": 1} # dict (key/value)

Type checks and casting

isinstance(x, int)
int("7")
float("3.5")
str(123)
🧩 Functions
OpenAI

Content for OpenAI

Claude

Content for Claude

πŸ“š Essential Packages
Dot-Env
Installation
pip install python-dotenv
uv add python-dotenv
Initialization
from dotenv import load_dotenv

load_dotenv()
import os

api_key = os.getenv("API_KEY")