Goal: Master Python for all 7 courses (A-G) in 8 days
Method: Reverse-mapped from 19 notebooks x 5 books
Principle: Teach only what's used, skip the rest
Variables: str, int, float, list, dict, bool
Control: if/elif/else, for, while
Functions: def, return, lambda
Classes: class, __init__, self, super(), inheritance
Exceptions: try/except/finally/raise
File I/O: open, with, read/write
Comprehensions: [x for x in list], {k:v for ...}
Slicing: arr[:3], arr[-2:], arr[1:5:2]
def ask_llm(prompt, temperature=0.3):
r = client.post("/chat/completions", json={
"model": "Qwen3.5-9B-Q4_K_M.gguf",
"messages": [{"role": "user", "content": prompt}],
"temperature": temperature
})
return r.json()["choices"][0]["message"]["content"]
import httpx
client = httpx.Client(base_url="http://localhost:8080/v1", timeout=30)
def ask_llm(prompt):
r = client.post("/chat/completions", json={
"model": "Qwen3.5-9B-Q4_K_M.gguf",
"messages": [{"role": "user", "content": prompt}],
"temperature": 0.3
})
return r.json()["choices"][0]["message"]["content"]
print("This function is used in ALL 7 courses")
import torch.nn as nn
class MyModel(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(10, 2)
def forward(self, x):
return self.fc(x)
def safe_ask_llm(prompt):
try:
return ask_llm(prompt)
except httpx.TimeoutException:
print("LLM timeout - log audit")
return None
except Exception as e:
print(f"Error: {e} - need human intervention")
return None
Core pattern used in ALL notebooks: httpx + JSON
import httpx, json
BASE = "http://localhost:8080/v1"
client = httpx.Client(base_url=BASE, timeout=60)
Pattern 1: Chat completion (all courses)
r = client.post("/chat/completions", json={
"model": "Qwen3.5-9B-Q4_K_M.gguf",
"messages": [{"role": "user", "content": prompt}],
})
reply = r.json()["choices"][0]["message"]["content"]
Pattern 2: Structured output (Course-D audit)
r = client.post("/chat/completions", json={
"response_format": {"type": "json_object"},
})
data = json.loads(r.json()["choices"][0]["message"]["content"])
import json
# Example: Use structured output for LLM audit
def audit_prompt(text):
r = client.post("/chat/completions", json={
"model": "Qwen3.5-9B-Q4_K_M.gguf",
"messages": [{"role": "user", "content":
f"Audit this text for PII leakage. Output JSON: {text}"}],
"response_format": {"type": "json_object"},
"temperature": 0.1
})
return json.loads(r.json()["choices"][0]["message"]["content"])
print("JSON mode = core skill for Course-D/F/G audit")
import pandas as pd
import re
Governance: data anonymization
df_clean = df.drop(columns=['name', 'phone'])
df_clean['age_group'] = pd.cut(df['age'], bins=[0,25,35,50,100])
Regex for PII detection
def detect_pii(text):
patterns = {
'phone': r'1[3-9]\\d{9}',
'id_card': r'\\d{17}[\\dX]',
}
return {k: re.findall(p, text) for k, p in patterns.items()}
import pandas as pd
records = pd.DataFrame({
'name': ['Zhang', 'Li', 'Wang'],
'phone': ['13800138000', '13912345678', '15088889999'],
'salary': [50000, 65000, 42000],
})
def anonymize(df):
df = df.copy()
df['name'] = '***'
df['phone'] = df['phone'].apply(lambda x: x[:3] + '****' + x[-4:])
return df
print("Before:")
print(records.to_string())
print("\nAfter:")
print(anonymize(records).to_string())
import torch
import torch.nn as nn
The 5-line training loop (core of Course-A)
model = nn.Linear(10, 2)
optimizer = torch.optim.Adam(model.parameters())
loss_fn = nn.CrossEntropyLoss()
for epoch in range(10):
logits = model(x_train)
loss = loss_fn(logits, y_train)
optimizer.zero_grad()
loss.backward()
optimizer.step()
import torch, torch.nn as nn
x_train = torch.randn(100, 10)
y_train = torch.randint(0, 2, (100,))
model = nn.Linear(10, 2)
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
loss_fn = nn.CrossEntropyLoss()
for epoch in range(3):
logits = model(x_train)
loss = loss_fn(logits, y_train)
optimizer.zero_grad()
loss.backward()
optimizer.step()
print(f"Epoch {epoch+1}: loss = {loss.item():.4f}")
print(R"""
Deployment: This IS the GPT training loop - Course-A core
Governance: Audit understands "what the model learns"
""")
import asyncio, httpx
async def process_batch(prompts):
async with httpx.AsyncClient(base_url=BASE, timeout=30) as c:
tasks = [ask_llm_async(c, p) for p in prompts]
return await asyncio.gather(*tasks)
import asyncio, httpx
BASE = "http://localhost:8080/v1"
async def ask(prompt):
async with httpx.AsyncClient(base_url=BASE, timeout=30) as c:
r = await c.post("/chat/completions", json={
"model": "Qwen3.5-9B-Q4_K_M.gguf",
"messages": [{"role": "user", "content": prompt}],
"temperature": 0.3
})
return r.json()["choices"][0]["message"]["content"]
async def main():
results = await asyncio.gather(
ask("What is Python?"), ask("What is AI?"), ask("What is ML?"))
for r in results:
print(f" {r[:60]}...")
print("async + httpx = Course-C/F/G async inference core")
Integrates all 7 course skills:
| Step | Skill | Course |
|------|-------|--------|
| 1. pandas load | Data Processing (L2) | C/D |
| 2. Anonymize | PII removal (L2) | D/G |
| 3. httpx + LLM | API Comms (L1) | ALL |
| 4. JSON output | Structured mode (L1) | D/F |
| 5. async batch | Production (L4) | C/F |
| 6. Exception handling | Pipeline (L0+L4) | C |
import pandas as pd, httpx, json
client = httpx.Client(base_url="http://localhost:8080/v1", timeout=30)
jobs = pd.DataFrame({
'title': ['AI Engineer', 'Compliance Expert', 'ML Engineer'],
'salary': [50000, 45000, 60000],
})
jobs_clean = jobs.copy()
print("Data loaded:", len(jobs), "records")
print(jobs_clean.to_string())
print()
print("PIN Governance: data anonymization + compliance audit")
print("ROCKET Deployment: LLM API + data pipeline + structured output")
| Direction | Next Step | Salary |
|-----------|-----------|:------:|
| ROCKET Model Building | Course-A LLM Basics (8w) | 30K-60K |
| ROCKET Inference Opt | Course-B Reasoning (4w) | 50K-100K |
| ROCKET Engineering | Course-C LLM Eng (14w) | 45K-120K |
| PIN Governance | Course-D AI Gov (6w) | 40K-52K |
| PIN FinLLM Ops | Course-G FinLLM (4w) | 45K-80K |
| BRIEFCASE Product | Course-E AI PM (4w) | 35K-65K |
| BULLSEYE Architecture | Course-F Eng Decision (4w) | 50K-130K |