8000 Add intro slides (#42) · gaehlerm/python-tutorial@db91c1c · GitHub
[go: up one dir, main page]

Skip to content

Commit db91c1c

Browse files
authored
Add intro slides (empa-scientific-it#42)
1 parent ad1e115 commit db91c1c

File tree

1 file changed

+183
-60
lines changed

1 file changed

+183
-60
lines changed

intro.ipynb

Lines changed: 183 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,222 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "code",
5-
"execution_count": null,
4+
"cell_type": "raw",
65
"metadata": {},
7-
"outputs": [],
86
"source": [
9-
"%%javascript\n",
10-
"IPython.OutputArea.prototype._should_scroll = function(lines) {\n",
11-
" return false;\n",
12-
"}"
7+
"---\n",
8+
"title: \"Python Tutorial 2023\"\n",
9+
"subtitle: \"17-20 April\"\n",
10+
"format: revealjs\n",
11+
"callout-icon: false\n",
12+
"jupyter: python3\n",
13+
"highlight-style: gruvbox\n",
14+
"execute:\n",
15+
" echo: true\n",
16+
" enabled: false\n",
17+
"---"
1318
]
1419
},
1520
{
16-
"cell_type": "code",
17-
"execution_count": null,
21+
"cell_type": "markdown",
1822
"metadata": {},
19-
"outputs": [],
2023
"source": [
21-
"import matplotlib.pyplot as plt\n",
22-
"import numpy as np\n",
23-
"%matplotlib inline"
24+
"## Welcome! 🐍\n",
25+
"\n",
26+
"Hello and welcome, everyone! We’re excited that you chose to embark in this Python journey\n",
27+
"\n",
28+
"Over **four** days, we'll see a lot of Python. **Two** fundamental topics each day\n",
29+
"\n",
30+
"::: {.panel-tabset}\n",
31+
"\n",
32+
"### Day 1\n",
33+
"1. Basic syntax and data ty 8000 pes\n",
34+
"2. Control flow, loops, and exceptions\n",
35+
"\n",
36+
"### Day 2\n",
37+
"1. Functions\n",
38+
"2. Working with files\n",
39+
"\n",
40+
"### Day 3\n",
41+
"1. Functional programming\n",
42+
"2. Object-oriented programming\n",
43+
"\n",
44+
"### Day 4\n",
45+
"1. Modules and packages\n",
46+
"2. Questions, exercises, more questions...\n",
47+
"\n",
48+
":::\n",
49+
"\n",
50+
"\n",
51+
"::: {.notes}\n",
52+
"\n",
53+
"Although this is an introductory course, we will be going quite in-depth to cover as much ground as possible. Our aim is to equip you with a strong foundation in Python programming that you can build on in the future. So, let's get started!\n",
54+
"\n",
55+
":::"
2456
]
2557
},
2658
{
27-
"cell_type": "code",
28-
"execution_count": null,
59+
"cell_type": "markdown",
2960
"metadata": {},
30-
"outputs": [],
3161
"source": [
32-
"plt.scatter(np.random.randn(1000),\n",
33-
" np.random.randn(1000),\n",
34-
" c=np.random.randn(1000), s=100)"
62+
"## Timetable\n",
63+
"\n",
64+
"**TL;DR:** Every morning, 9:00-13:00, on Zoom\n",
65+
"\n",
66+
". . .\n",
67+
"\n",
68+
"More in detail:\n",
69+
"\n",
70+
"::: {.incremental}\n",
71+
"\n",
72+
"- 8:45-9:00 — Welcome, warm-up questions\n",
73+
"- 9:00-10:50 — Topic 1 (theory, hands-on, Q&A)\n",
74+
"- *10:50-11:10 — Break ☕*\n",
75+
"- 11:10-13:00 — Topic 2\n",
76+
"\n",
77+
":::"
3578
]
3679
},
3780
{
38-
"cell_type": "code",
39-
"execution_count": null,
81+
"cell_type": "markdown",
4082
"metadata": {},
41-
"outputs": [],
4283
"source": [
43-
"from tutorial.common import Question, Quiz"
84+
"## How to interact\n",
85+
"\n",
86+
"::: {.notes}\n",
87+
"\n",
88+
"Each block is 20% theory and 80% hands-on. It's an online workshop, so interaction between us is **essential**\n",
89+
"\n",
90+
":::\n",
91+
"\n",
92+
"A few tips to interact:\n",
93+
"\n",
94+
"::: {.panel-tabset}\n",
95+
"\n",
96+
"### On Zoom\n",
97+
"- Raise your hand 🤚 then ask\n",
98+
"- Write in the chat\n",
99+
"- We will open a break-out room to address longer questions. **Anyone** interested can jump in\n",
100+
"\n",
101+
"\n",
102+
"### On Slack\n",
103+
"- Ask your question in the **corresponding channel**. Use `#help` for generic questions\n",
104+
"- Reply **in a thread** if you want to add a comment on another question\n",
105+
"- Use `@Sasha`, `@Simone`, `@Edoardo` if you want to mention the tutorial instructors directly\n",
106+
"\n",
107+
":::\n",
108+
"\n",
109+
"::: {.notes}\n",
110+
"\n",
111+
"Although the chat will be distributed together with the recording, Slack is much better suited to hold continued Q&A and other discussions. Please, use it.\n",
112+
"\n",
113+
":::"
44114
]
45115
},
46116
{
47-
"cell_type": "code",
48-
"execution_count": null,
117+
"cell_type": "markdown",
49118
"metadata": {},
50-
"outputs": [],
51119
"source": [
52-
"q1 = Question(\n",
53-
" question='What is the answer to life, the universe, and everything?',\n",
54-
" options={\n",
55-
" '42': 'The answer is 42! You are correct!',\n",
56-
" '41': 'A bit more',\n",
57-
" '44': 'A bit less',\n",
58-
" '45': 'A bit less',\n",
59-
" },\n",
60-
" hint=\"2**2 * 10 + 4\",\n",
61-
" correct_answer='42',\n",
62-
" shuffle=True,\n",
63-
" )\n",
64-
"\n",
65-
"q2 = Question(\n",
66-
" question=\"How many planets are there in our solar system?\",\n",
67-
" options={\n",
68-
" '8': 'The answer is 8. You are correct!',\n",
69-
" '9': 'You are close, but not quite there.',\n",
70-
" '10': 'A bit less.',\n",
71-
" },\n",
72-
" hint=\"pluto is not a planet anymore.\",\n",
73-
" correct_answer='8',\n",
74-
" shuffle=True,\n",
75-
" )\n",
76-
"\n",
77-
"quiz = Quiz(questions=[q1, q2])\n",
120+
"## How to use notebooks\n",
78121
"\n",
122+
"\n",
123+
"1. The link to open Binder is on Slack in `#announcements` and in Zoom's chat\n",
124+
"2. Open the `index.ipynb` file and click on the current topic link\n",
125+
"3. Run the code, modify, experiment\n",
79126
"\n"
80127
]
81128
},
82129
{
83-
"cell_type": "code",
84-
"execution_count": null,
130+
"cell_type": "markdown",
85131
"metadata": {
86-
"scrolled": true
132+
"tags": []
87133
},
88-
"outputs": [],
89134
"source": [
90-
"display(quiz)"
135+
"## Exercises 🌶️\n",
136+
"\n",
137+
"::: {.fragment}\n",
138+
"\n",
139+
"For each topic we prepared a bunch of exercises to practice the concepts\n",
140+
"\n",
141+
":::\n",
142+
"\n",
143+
"::: {.fragment}\n",
144+
"\n",
145+
"You will see cells like\n",
146+
"\n",
147+
"```{.python code-line-numbers=\"false\"}\n",
148+
"%%ipytest\n",
149+
"\n",
150+
"def solution_to_exercise(input_arg):\n",
151+
" \"\"\"\n",
152+
" Write your solution here\n",
153+
" \"\"\"\n",
154+
" pass\n",
155+
"```\n",
156+
"\n",
157+
"**Unless otherwise noted**, you can delete everything *below* the line starting with `def` and write your solution\n",
158+
"\n",
159+
":::\n",
160+
"\n",
161+
"::: {.notes}\n",
162+
"\n",
163+
"The \"chili\" 🌶️ symbol estimates the effort required. In general, more chilis mean more work and thinking to solve the exercise\n",
164+
"\n",
165+
"Double-check before deleting everything in a solution's cell. There might be useful hints to solve the exercise!\n",
166+
"\n",
167+
":::"
168+
]
169+
},
170+
{
171+
"cell_type": "markdown",
172+
"metadata": {},
173+
"source": [
174+
"## Exercises 🌶️\n",
175+
"\n",
176+
"::: {.callout-important}\n",
177+
"\n",
178+
"If you tried to evaluate an exercise cell and you see the error\n",
179+
"\n",
180+
"```\n",
181+
"UsageError: Cell magic %%ipytest not found\n",
182+
"```\n",
183+
"\n",
184+
"make sure you **first** evaluate the cell with the content below\n",
185+
"\n",
186+
"```\n",
187+
"%reload_ext tutorial.tests.testsuite\n",
188+
"```\n",
189+
"\n",
190+
"You should find it just after the **Exercises** section heading\n",
191+
"\n",
192+
":::\n",
193+
"\n",
194+
". . .\n",
195+
"\n",
196+
"::: {.callout-tip}\n",
197+
"\n",
198+
"There might be more exercises than time available. Don't worry, you can come back and continue any time, even after the workshop\n",
199+
"\n",
200+
":::\n",
201+
"\n",
202+
"::: {.notes}\n",
203+
"\n",
204+
"Remember: **ask** if you need help, either on Zoom or on Slack. These four days should be a practical workshop where we can answer to most of your questions you have as a beginner Python user. Let's make the most out of this time!\n",
205+
"\n",
206+
":::"
207+
]
208+
},
209+
{
210+
"cell_type": "markdown",
211+
"metadata": {},
212+
"source": [
213+
"# Let's get started! 🐍"
91214
]
92215
}
93216
],
94217
"metadata": {
95218
"kernelspec": {
96-
"display_name": "Python 3",
219+
"display_name": "Python 3 (ipykernel)",
97220
"language": "python",
98221
"name": "python3"
99222
},
@@ -107,7 +230,7 @@
107230
"name": "python",
108231
"nbconvert_exporter": "python",
109232
"pygments_lexer": "ipython3",
110-
"version": "3.7.3"
233+
"version": "3.11.0"
111234
},
112235
"vscode": {
113236
"interpreter": {
@@ -116,5 +239,5 @@
116239
}
117240
},
118241
"nbformat": 4,
119-
"nbformat_minor": 2
242+
"nbformat_minor": 4
120243
}

0 commit comments

Comments
 (0)
0