Skip to content

Commit 06a426e

Browse files
committed
Add more self exercises
1 parent e067f99 commit 06a426e

15 files changed

+813
-326
lines changed

content/01_python_fundamentals_refresh.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
"source": [
3232
"You can install Python from the official Python download URL: https://www.python.org/downloads/\n",
3333
"\n",
34-
"Remember to add Python to the system path and disable path limit\n",
35-
"\n",
3634
"<img src=\"./static/install-python.png\" width=\"700\">\n",
3735
"\n",
36+
"***Remember to add Python to the system path and disable path limit***\n",
37+
"\n",
3838
"<img src=\"./static/install-python-add-to-path.jpg\" width=\"700\">\n",
3939
"\n",
4040
"<img src=\"./static/install-python-disable-path-limit.jpg\" width=\"700\">"

content/02_python_basics.ipynb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
"source": [
8080
"print(type(a))\n",
8181
"print(type(b))\n",
82-
"print(type(c))"
82+
"print(type(c))\n",
83+
"print(type(d))"
8384
]
8485
},
8586
{
@@ -109,7 +110,7 @@
109110
"- A variable name cannot start with a number\n",
110111
"- A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )\n",
111112
"- Variable names are case-sensitive\n",
112-
"- A variable name cannot be any of the Python keywords"
113+
"- A variable name should not be any of the Python keywords"
113114
]
114115
},
115116
{
@@ -329,7 +330,18 @@
329330
"print(a, b, c)\n",
330331
"print(a is b)\n",
331332
"print(a == b)\n",
332-
"print(a is c)\n"
333+
"print(a is c)"
334+
]
335+
},
336+
{
337+
"cell_type": "code",
338+
"execution_count": null,
339+
"metadata": {},
340+
"outputs": [],
341+
"source": [
342+
"print(id(a))\n",
343+
"print(id(b))\n",
344+
"print(id(c))"
333345
]
334346
},
335347
{
@@ -439,7 +451,7 @@
439451
"metadata": {},
440452
"outputs": [],
441453
"source": [
442-
"len(a)"
454+
"len(name)"
443455
]
444456
},
445457
{

content/03_lists_tuples_sets_dictionaries.ipynb

Lines changed: 54 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"metadata": {},
5555
"outputs": [],
5656
"source": [
57-
"a.append(4)"
57+
"a.append(4)\n",
58+
"print(a)"
5859
]
5960
},
6061
{
@@ -63,7 +64,8 @@
6364
"metadata": {},
6465
"outputs": [],
6566
"source": [
66-
"a.insert(1, 1.5)"
67+
"a.insert(1, 1.5)\n",
68+
"print(a)"
6769
]
6870
},
6971
{
@@ -72,7 +74,8 @@
7274
"metadata": {},
7375
"outputs": [],
7476
"source": [
75-
"a.extend([5, 6, 7])"
77+
"a.extend([5, 6, 7])\n",
78+
"print(a)"
7679
]
7780
},
7881
{
@@ -106,6 +109,15 @@
106109
"print(a)"
107110
]
108111
},
112+
{
113+
"cell_type": "code",
114+
"execution_count": null,
115+
"metadata": {},
116+
"outputs": [],
117+
"source": [
118+
"reversed(a)"
119+
]
120+
},
109121
{
110122
"cell_type": "code",
111123
"execution_count": null,
@@ -121,7 +133,8 @@
121133
"metadata": {},
122134
"outputs": [],
123135
"source": [
124-
"b.sort()"
136+
"b.sort()\n",
137+
"print(b)"
125138
]
126139
},
127140
{
@@ -166,7 +179,15 @@
166179
"metadata": {},
167180
"outputs": [],
168181
"source": [
169-
"print(animals[-2])\n",
182+
"print(animals[-2])"
183+
]
184+
},
185+
{
186+
"cell_type": "code",
187+
"execution_count": null,
188+
"metadata": {},
189+
"outputs": [],
190+
"source": [
170191
"print(animals[-2:])"
171192
]
172193
},
@@ -227,7 +248,7 @@
227248
},
228249
{
229250
"cell_type": "code",
230-
"execution_count": 2,
251+
"execution_count": null,
231252
"metadata": {},
232253
"outputs": [],
233254
"source": [
@@ -237,150 +258,18 @@
237258
},
238259
{
239260
"cell_type": "code",
240-
"execution_count": 3,
241-
"metadata": {},
242-
"outputs": [
243-
{
244-
"data": {
245-
"text/plain": [
246-
"['__and__',\n",
247-
" '__class__',\n",
248-
" '__class_getitem__',\n",
249-
" '__contains__',\n",
250-
" '__delattr__',\n",
251-
" '__dir__',\n",
252-
" '__doc__',\n",
253-
" '__eq__',\n",
254-
" '__format__',\n",
255-
" '__ge__',\n",
256-
" '__getattribute__',\n",
257-
" '__gt__',\n",
258-
" '__hash__',\n",
259-
" '__iand__',\n",
260-
" '__init__',\n",
261-
" '__init_subclass__',\n",
262-
" '__ior__',\n",
263-
" '__isub__',\n",
264-
" '__iter__',\n",
265-
" '__ixor__',\n",
266-
" '__le__',\n",
267-
" '__len__',\n",
268-
" '__lt__',\n",
269-
" '__ne__',\n",
270-
" '__new__',\n",
271-
" '__or__',\n",
272-
" '__rand__',\n",
273-
" '__reduce__',\n",
274-
" '__reduce_ex__',\n",
275-
" '__repr__',\n",
276-
" '__ror__',\n",
277-
" '__rsub__',\n",
278-
" '__rxor__',\n",
279-
" '__setattr__',\n",
280-
" '__sizeof__',\n",
281-
" '__str__',\n",
282-
" '__sub__',\n",
283-
" '__subclasshook__',\n",
284-
" '__xor__',\n",
285-
" 'add',\n",
286-
" 'clear',\n",
287-
" 'copy',\n",
288-
" 'difference',\n",
289-
" 'difference_update',\n",
290-
" 'discard',\n",
291-
" 'intersection',\n",
292-
" 'intersection_update',\n",
293-
" 'isdisjoint',\n",
294-
" 'issubset',\n",
295-
" 'issuperset',\n",
296-
" 'pop',\n",
297-
" 'remove',\n",
298-
" 'symmetric_difference',\n",
299-
" 'symmetric_difference_update',\n",
300-
" 'union',\n",
301-
" 'update']"
302-
]
303-
},
304-
"execution_count": 3,
305-
"metadata": {},
306-
"output_type": "execute_result"
307-
}
308-
],
261+
"execution_count": null,
262+
"metadata": {},
263+
"outputs": [],
309264
"source": [
310265
"dir(my_set)"
311266
]
312267
},
313268
{
314269
"cell_type": "code",
315-
"execution_count": 4,
316-
"metadata": {},
317-
"outputs": [
318-
{
319-
"data": {
320-
"text/plain": [
321-
"['update',\n",
322-
" 'union',\n",
323-
" 'symmetric_difference_update',\n",
324-
" 'symmetric_difference',\n",
325-
" 'remove',\n",
326-
" 'pop',\n",
327-
" 'issuperset',\n",
328-
" 'issubset',\n",
329-
" 'isdisjoint',\n",
330-
" 'intersection_update',\n",
331-
" 'intersection',\n",
332-
" 'discard',\n",
333-
" 'difference_update',\n",
334-
" 'difference',\n",
335-
" 'copy',\n",
336-
" 'clear',\n",
337-
" 'add',\n",
338-
" '__xor__',\n",
339-
" '__subclasshook__',\n",
340-
" '__sub__',\n",
341-
" '__str__',\n",
342-
" '__sizeof__',\n",
343-
" '__setattr__',\n",
344-
" '__rxor__',\n",
345-
" '__rsub__',\n",
346-
" '__ror__',\n",
347-
" '__repr__',\n",
348-
" '__reduce_ex__',\n",
349-
" '__reduce__',\n",
350-
" '__rand__',\n",
351-
" '__or__',\n",
352-
" '__new__',\n",
353-
" '__ne__',\n",
354-
" '__lt__',\n",
355-
" '__len__',\n",
356-
" '__le__',\n",
357-
" '__ixor__',\n",
358-
" '__iter__',\n",
359-
" '__isub__',\n",
360-
" '__ior__',\n",
361-
" '__init_subclass__',\n",
362-
" '__init__',\n",
363-
" '__iand__',\n",
364-
" '__hash__',\n",
365-
" '__gt__',\n",
366-
" '__getattribute__',\n",
367-
" '__ge__',\n",
368-
" '__format__',\n",
369-
" '__eq__',\n",
370-
" '__doc__',\n",
371-
" '__dir__',\n",
372-
" '__delattr__',\n",
373-
" '__contains__',\n",
374-
" '__class_getitem__',\n",
375-
" '__class__',\n",
376-
" '__and__']"
377-
]
378-
},
379-
"execution_count": 4,
380-
"metadata": {},
381-
"output_type": "execute_result"
382-
}
383-
],
270+
"execution_count": null,
271+
"metadata": {},
272+
"outputs": [],
384273
"source": [
385274
"list(reversed(dir(my_set)))"
386275
]
@@ -478,8 +367,24 @@
478367
"metadata": {},
479368
"outputs": [],
480369
"source": [
481-
"print(sample_dict[\"one\"])\n",
482-
"print(sample_dict.get(\"two\"))\n",
370+
"print(sample_dict[\"one\"])"
371+
]
372+
},
373+
{
374+
"cell_type": "code",
375+
"execution_count": null,
376+
"metadata": {},
377+
"outputs": [],
378+
"source": [
379+
"print(sample_dict.get(\"two\"))"
380+
]
381+
},
382+
{
383+
"cell_type": "code",
384+
"execution_count": null,
385+
"metadata": {},
386+
"outputs": [],
387+
"source": [
483388
"print(sample_dict.get(\"four\", 4))"
484389
]
485390
},
@@ -551,8 +456,9 @@
551456
"cell_type": "markdown",
552457
"metadata": {},
553458
"source": [
554-
"1. Create a list of dictionaries\n",
555-
"2. Show an example of where sets would work better than lists"
459+
"1. Store the marks of 4 subjects for 3 students. You should be able to retrieve all the marks easily with the student's name.\n",
460+
"2. Show an example of where sets would work better than lists.\n",
461+
"3. Store your idsid and password. You should not be able to modify this after setting it the first time."
556462
]
557463
},
558464
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy