Skip to content

Commit 2516d06

Browse files
Regenerate python_recap notebooks
1 parent 589567c commit 2516d06

File tree

6 files changed

+298
-155
lines changed

6 files changed

+298
-155
lines changed

notebooks/python_recap/01-basic.ipynb

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
"source": [
77
"# Python the basics: datatypes\n",
88
"\n",
9-
"> *DS Data manipulation, analysis and visualisation in Python* \n",
10-
"> *December, 2017*\n",
11-
"\n",
12-
"> *© 2016, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
13-
"\n",
9+
"> *DS Data manipulation, analysis and visualization in Python* \n",
10+
"> *May/June, 2021*\n",
11+
">\n",
12+
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
1413
"\n",
1514
"---\n",
1615
"\n",
@@ -404,7 +403,8 @@
404403
"run_control": {
405404
"frozen": false,
406405
"read_only": false
407-
}
406+
},
407+
"tags": []
408408
},
409409
"outputs": [],
410410
"source": [
@@ -418,7 +418,8 @@
418418
"run_control": {
419419
"frozen": false,
420420
"read_only": false
421-
}
421+
},
422+
"tags": []
422423
},
423424
"outputs": [],
424425
"source": [
@@ -545,11 +546,12 @@
545546
"run_control": {
546547
"frozen": false,
547548
"read_only": false
548-
}
549+
},
550+
"tags": []
549551
},
550552
"outputs": [],
551553
"source": [
552-
"# %load _solutions/01-basic24.py"
554+
"a_third_list.count?"
553555
]
554556
},
555557
{
@@ -560,11 +562,12 @@
560562
"run_control": {
561563
"frozen": false,
562564
"read_only": false
563-
}
565+
},
566+
"tags": []
564567
},
565568
"outputs": [],
566569
"source": [
567-
"# %load _solutions/01-basic25.py"
570+
"a_third_list.index??"
568571
]
569572
},
570573
{
@@ -581,7 +584,8 @@
581584
"run_control": {
582585
"frozen": false,
583586
"read_only": false
584-
}
587+
},
588+
"tags": []
585589
},
586590
"outputs": [],
587591
"source": [
@@ -625,7 +629,7 @@
625629
},
626630
"outputs": [],
627631
"source": [
628-
"# %load _solutions/01-basic28.py"
632+
"a_third_list[::-1]"
629633
]
630634
},
631635
{
@@ -674,7 +678,8 @@
674678
"run_control": {
675679
"frozen": false,
676680
"read_only": false
677-
}
681+
},
682+
"tags": []
678683
},
679684
"outputs": [],
680685
"source": [
@@ -834,11 +839,12 @@
834839
"run_control": {
835840
"frozen": false,
836841
"read_only": false
837-
}
842+
},
843+
"tags": []
838844
},
839845
"outputs": [],
840846
"source": [
841-
"## pay attention when using apostrophes! - test out the nxt two lines one at a time\n",
847+
"## pay attention when using apostrophes! - test out the next two lines one at a time\n",
842848
"#print('Hi, what's up?')\n",
843849
"#print(\"Hi, what's up?\")"
844850
]
@@ -925,7 +931,8 @@
925931
"run_control": {
926932
"frozen": false,
927933
"read_only": false
928-
}
934+
},
935+
"tags": []
929936
},
930937
"outputs": [],
931938
"source": [
@@ -946,7 +953,8 @@
946953
"run_control": {
947954
"frozen": false,
948955
"read_only": false
949-
}
956+
},
957+
"tags": []
950958
},
951959
"outputs": [],
952960
"source": [
@@ -1047,7 +1055,7 @@
10471055
},
10481056
"outputs": [],
10491057
"source": [
1050-
"# %load _solutions/01-basic47.py"
1058+
"[el for el in dir(list) if not el[0]=='_']"
10511059
]
10521060
},
10531061
{
@@ -1066,7 +1074,8 @@
10661074
"run_control": {
10671075
"frozen": false,
10681076
"read_only": false
1069-
}
1077+
},
1078+
"tags": []
10701079
},
10711080
"outputs": [],
10721081
"source": [
@@ -1085,7 +1094,8 @@
10851094
},
10861095
"outputs": [],
10871096
"source": [
1088-
"# %load _solutions/01-basic49.py"
1097+
"#split in words and get word lengths\n",
1098+
"[len(word) for word in sentence.split()]"
10891099
]
10901100
},
10911101
{
@@ -1233,14 +1243,16 @@
12331243
"metadata": {},
12341244
"source": [
12351245
"<div class=\"alert alert alert-success\">\n",
1236-
" <b>Exercise</b> Put all keys of the hourly_wage dictionary in a list as strings. If their not yet a string, convert them:\n",
1246+
" <b>Exercise</b> Put all keys of the `hourly_wage` dictionary in a list as strings. If they are not yet a string, convert them:\n",
12371247
"</div>"
12381248
]
12391249
},
12401250
{
12411251
"cell_type": "code",
12421252
"execution_count": null,
1243-
"metadata": {},
1253+
"metadata": {
1254+
"tags": []
1255+
},
12441256
"outputs": [],
12451257
"source": [
12461258
"hourly_wage = {'Jos':10, 'Frida': 9, 'Gaspard': '13', 23 : 3}"
@@ -1258,7 +1270,10 @@
12581270
},
12591271
"outputs": [],
12601272
"source": [
1261-
"# %load _solutions/01-basic58.py"
1273+
"str_key = []\n",
1274+
"for key in hourly_wage.keys():\n",
1275+
" str_key.append(str(key))\n",
1276+
"str_key"
12621277
]
12631278
},
12641279
{
@@ -1339,7 +1354,7 @@
13391354
"name": "python",
13401355
"nbconvert_exporter": "python",
13411356
"pygments_lexer": "ipython3",
1342-
"version": "3.7.3"
1357+
"version": "3.8.10"
13431358
},
13441359
"nav_menu": {},
13451360
"toc": {
@@ -1353,5 +1368,5 @@
13531368
}
13541369
},
13551370
"nbformat": 4,
1356-
"nbformat_minor": 1
1371+
"nbformat_minor": 4
13571372
}

0 commit comments

Comments
 (0)