Skip to content

Commit 32f1769

Browse files
committed
replace some formats
1 parent 9769fcb commit 32f1769

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

content/01-python/w3-python-exercises.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
},
272272
{
273273
"cell_type": "code",
274-
"execution_count": 9,
274+
"execution_count": 1,
275275
"metadata": {},
276276
"outputs": [
277277
{
@@ -288,7 +288,7 @@
288288
" 's9': ''}"
289289
]
290290
},
291-
"execution_count": 9,
291+
"execution_count": 1,
292292
"metadata": {},
293293
"output_type": "execute_result"
294294
}
@@ -298,7 +298,7 @@
298298
"\n",
299299
"def initialize_board(play):\n",
300300
" for n in range(9):\n",
301-
" play[\"s{}\".format(n+1)] = \"\"\n",
301+
" play[f\"s{n+1}\"] = \"\"\n",
302302
"\n",
303303
"initialize_board(play)\n",
304304
"play"

content/01-python/w4-python-exercises.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
" self.quantity = quantity\n",
113113
" \n",
114114
" def __repr__(self):\n",
115-
" return \"{}: {}\".format(self.name, self.quantity)\n",
115+
" return f\"{self.name}: {self.quantity}\"\n",
116116
" \n",
117117
" def __eq__(self, other):\n",
118118
" \"\"\"check if the items have the same name\"\"\"\n",
@@ -417,7 +417,7 @@
417417
"name": "python",
418418
"nbconvert_exporter": "python",
419419
"pygments_lexer": "ipython3",
420-
"version": "3.10.2"
420+
"version": "3.11.6"
421421
}
422422
},
423423
"nbformat": 4,

content/02-numpy/numpy-basics.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"<div class=\"alert alert-block alert-warning\">\n",
21+
"````{note}\n",
2222
" \n",
23-
"Note that the traditional way to import numpy is to rename it np. This saves on typing and makes your code a little more compact.</div>"
23+
"Note that the traditional way to import numpy is to rename it np. This saves on typing and makes your code a little more compact.\n",
24+
"````"
2425
]
2526
},
2627
{
@@ -1146,7 +1147,7 @@
11461147
" g[i,j] = np.sin(2.0*np.pi*x[i]*y[j])\n",
11471148
" \n",
11481149
"t1 = time.time()\n",
1149-
"print(\"time elapsed: {} s\".format(t1-t0))"
1150+
"print(f\"time elapsed: {t1-t0} s\""
11501151
]
11511152
},
11521153
{
@@ -1180,7 +1181,7 @@
11801181
"t0 = time.time()\n",
11811182
"g2 = np.sin(2.0*np.pi*x2d*y2d)\n",
11821183
"t1 = time.time()\n",
1183-
"print(\"time elapsed: {} s\".format(t1-t0))"
1184+
"print(f\"time elapsed: {t1-t0} s\""
11841185
]
11851186
},
11861187
{
@@ -1273,7 +1274,7 @@
12731274
"name": "python",
12741275
"nbconvert_exporter": "python",
12751276
"pygments_lexer": "ipython3",
1276-
"version": "3.10.9"
1277+
"version": "3.11.6"
12771278
}
12781279
},
12791280
"nbformat": 4,

content/02-numpy/numpy-exercises.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
"name": "python",
225225
"nbconvert_exporter": "python",
226226
"pygments_lexer": "ipython3",
227-
"version": "3.10.2"
227+
"version": "3.11.6"
228228
}
229229
},
230230
"nbformat": 4,

content/11-machine-learning/keras-mnist.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@
960960
" try:\n",
961961
" res = model.predict(np.array([x]), verbose=0)\n",
962962
" if np.argmax(res) != np.argmax(y):\n",
963-
" print(\"test {}: prediction = {}, truth is {}\".format(n, np.argmax(res), np.argmax(y)))\n",
963+
" print(f\"test {n}: prediction = {np.argmax(res)}, truth is {np.argmax(y)}\"\n",
964964
" plt.imshow(x.reshape(28, 28), cmap=\"gray_r\")\n",
965965
" plt.show()\n",
966966
" wrong += 1\n",

0 commit comments

Comments
 (0)