108 lines
2.4 KiB
Plaintext
108 lines
2.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Tutorial: TITLE\n",
|
|
"\n",
|
|
"Audience:\n",
|
|
"- Describe who this is for.\n",
|
|
"\n",
|
|
"Prerequisites:\n",
|
|
"- List required concepts or setup.\n",
|
|
"\n",
|
|
"Learning goals:\n",
|
|
"- By the end, the reader can...\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Outline\n",
|
|
"\n",
|
|
"1. Setup\n",
|
|
"2. A minimal working example\n",
|
|
"3. Variations and pitfalls\n",
|
|
"4. Exercises\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Setup cell: keep it short and deterministic\n",
|
|
"from __future__ import annotations\n",
|
|
"\n",
|
|
"import math\n",
|
|
"import random\n",
|
|
"\n",
|
|
"SEED = 21\n",
|
|
"random.seed(SEED)\n",
|
|
"SEED\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Step 1 - Start with a tiny example\n",
|
|
"\n",
|
|
"Explain what the next cell does in plain language.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Minimal working example\n",
|
|
"angles = [0, math.pi / 4, math.pi / 2]\n",
|
|
"sines = [math.sin(a) for a in angles]\n",
|
|
"list(zip(angles, sines))\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Exercises\n",
|
|
"\n",
|
|
"- Try a different input.\n",
|
|
"- Predict the output before running the code.\n",
|
|
"- Note one common mistake and how to fix it.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Exercise answer scaffold\n",
|
|
"def describe(values: list[float]) -> dict[str, float]:\n",
|
|
" return {\"min\": min(values), \"max\": max(values)}\n",
|
|
"\n",
|
|
"describe(sines)\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"name": "python",
|
|
"version": "3.12"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|