跳到主要内容

Jupyter 笔记本整理

收藏0

Jupyter Notebook

创建、整理和改造 Jupyter Notebook,用于实验记录、教程和可复现分析。

让 AI 安装

灵栈官方最新版本 0.1.0更新于 2026-10-16下载 1 次

  • Jupyter
  • Notebook
  • 实验记录
  • 教程
  • Python
  • 可复现

assets/tutorial-template.ipynb

2.4 KB
1{
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# Tutorial: TITLE\n",
8 "\n",
9 "Audience:\n",
10 "- Describe who this is for.\n",
11 "\n",
12 "Prerequisites:\n",
13 "- List required concepts or setup.\n",
14 "\n",
15 "Learning goals:\n",
16 "- By the end, the reader can...\n"
17 ]
18 },
19 {
20 "cell_type": "markdown",
21 "metadata": {},
22 "source": [
23 "## Outline\n",
24 "\n",
25 "1. Setup\n",
26 "2. A minimal working example\n",
27 "3. Variations and pitfalls\n",
28 "4. Exercises\n"
29 ]
30 },
31 {
32 "cell_type": "code",
33 "execution_count": null,
34 "metadata": {},
35 "outputs": [],
36 "source": [
37 "# Setup cell: keep it short and deterministic\n",
38 "from __future__ import annotations\n",
39 "\n",
40 "import math\n",
41 "import random\n",
42 "\n",
43 "SEED = 21\n",
44 "random.seed(SEED)\n",
45 "SEED\n"
46 ]
47 },
48 {
49 "cell_type": "markdown",
50 "metadata": {},
51 "source": [
52 "## Step 1 - Start with a tiny example\n",
53 "\n",
54 "Explain what the next cell does in plain language.\n"
55 ]
56 },
57 {
58 "cell_type": "code",
59 "execution_count": null,
60 "metadata": {},
61 "outputs": [],
62 "source": [
63 "# Minimal working example\n",
64 "angles = [0, math.pi / 4, math.pi / 2]\n",
65 "sines = [math.sin(a) for a in angles]\n",
66 "list(zip(angles, sines))\n"
67 ]
68 },
69 {
70 "cell_type": "markdown",
71 "metadata": {},
72 "source": [
73 "## Exercises\n",
74 "\n",
75 "- Try a different input.\n",
76 "- Predict the output before running the code.\n",
77 "- Note one common mistake and how to fix it.\n"
78 ]
79 },
80 {
81 "cell_type": "code",
82 "execution_count": null,
83 "metadata": {},
84 "outputs": [],
85 "source": [
86 "# Exercise answer scaffold\n",
87 "def describe(values: list[float]) -> dict[str, float]:\n",
88 " return {\"min\": min(values), \"max\": max(values)}\n",
89 "\n",
90 "describe(sines)\n"
91 ]
92 }
93 ],
94 "metadata": {
95 "kernelspec": {
96 "display_name": "Python 3",
97 "language": "python",
98 "name": "python3"
99 },
100 "language_info": {
101 "name": "python",
102 "version": "3.12"
103 }
104 },
105 "nbformat": 4,
106 "nbformat_minor": 5
107}

文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。