Skip to content

Commit fb4b0e6

Browse files
committed
Add numbering and regenerate html
Also fixed some ipytest things
1 parent f47a423 commit fb4b0e6

File tree

90 files changed

+378126
-296121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+378126
-296121
lines changed

notebooks/beginner/exercises/strings_exercise.ipynb renamed to notebooks/beginner/exercises/01_strings_exercise.ipynb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"metadata": {},
1515
"outputs": [],
1616
"source": [
17-
"original = ' Python strings are COOL! '\n",
17+
"original = \" Python strings are COOL! \"\n",
1818
"lower_cased = original._____\n",
1919
"stripped = ____.strip()\n",
2020
"stripped_lower_cased = original._____._____"
@@ -35,9 +35,9 @@
3535
},
3636
"outputs": [],
3737
"source": [
38-
"assert lower_cased == ' python strings are cool! '\n",
39-
"assert stripped == 'Python strings are COOL!'\n",
40-
"assert stripped_lower_cased == 'python strings are cool!'"
38+
"assert lower_cased == \" python strings are cool! \"\n",
39+
"assert stripped == \"Python strings are COOL!\"\n",
40+
"assert stripped_lower_cased == \"python strings are cool!\""
4141
]
4242
},
4343
{
@@ -56,7 +56,7 @@
5656
},
5757
"outputs": [],
5858
"source": [
59-
"ugly = ' tiTle of MY new Book\\n\\n'"
59+
"ugly = \" tiTle of MY new Book\\n\\n\""
6060
]
6161
},
6262
{
@@ -66,7 +66,7 @@
6666
"outputs": [],
6767
"source": [
6868
"# Your implementation:\n",
69-
"pretty = 'TODO'"
69+
"pretty = \"TODO\""
7070
]
7171
},
7272
{
@@ -84,8 +84,8 @@
8484
},
8585
"outputs": [],
8686
"source": [
87-
"print('pretty: {}'.format(pretty))\n",
88-
"assert pretty == 'Title Of My New Book'"
87+
"print(\"pretty: {}\".format(pretty))\n",
88+
"assert pretty == \"Title Of My New Book\""
8989
]
9090
},
9191
{
@@ -104,9 +104,9 @@
104104
},
105105
"outputs": [],
106106
"source": [
107-
"verb = 'is'\n",
108-
"language = 'Python'\n",
109-
"punctuation = '!'"
107+
"verb = \"is\"\n",
108+
"language = \"Python\"\n",
109+
"punctuation = \"!\""
110110
]
111111
},
112112
{
@@ -116,7 +116,7 @@
116116
"outputs": [],
117117
"source": [
118118
"# Your implementation:\n",
119-
"sentence = 'TODO'"
119+
"sentence = \"TODO\""
120120
]
121121
},
122122
{
@@ -127,8 +127,8 @@
127127
},
128128
"outputs": [],
129129
"source": [
130-
"print('sentence: {}'.format(sentence))\n",
131-
"assert sentence == 'Learning Python is fun!'"
130+
"print(\"sentence: {}\".format(sentence))\n",
131+
"assert sentence == \"Learning Python is fun!\""
132132
]
133133
}
134134
],

notebooks/beginner/exercises/numbers_exercise.ipynb renamed to notebooks/beginner/exercises/02_numbers_exercise.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
},
4444
"outputs": [],
4545
"source": [
46-
"\n",
4746
"assert result == 50"
4847
]
4948
},
@@ -57,7 +56,7 @@
5756
},
5857
{
5958
"cell_type": "code",
60-
"execution_count": 4,
59+
"execution_count": null,
6160
"metadata": {},
6261
"outputs": [],
6362
"source": [

notebooks/beginner/exercises/conditionals_exercise.ipynb renamed to notebooks/beginner/exercises/03_conditionals_exercise.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"outputs": [],
1818
"source": [
19-
"name = 'John Doe'"
19+
"name = \"John Doe\""
2020
]
2121
},
2222
{
@@ -27,19 +27,19 @@
2727
"source": [
2828
"if ____:\n",
2929
" print('Name \"{}\" is more than 20 chars long'.format(name))\n",
30-
" length_description = 'long'\n",
30+
" length_description = \"long\"\n",
3131
"elif ____:\n",
3232
" print('Name \"{}\" is more than 15 chars long'.format(name))\n",
33-
" length_description = 'semi long'\n",
33+
" length_description = \"semi long\"\n",
3434
"elif ____:\n",
3535
" print('Name \"{}\" is more than 10 chars long'.format(name))\n",
36-
" length_description = 'semi long'\n",
36+
" length_description = \"semi long\"\n",
3737
"elif ____:\n",
3838
" print('Name \"{}\" is 8, 9 or 10 chars long'.format(name))\n",
39-
" length_description = 'semi short'\n",
39+
" length_description = \"semi short\"\n",
4040
"else:\n",
4141
" print('Name \"{}\" is a short name'.format(name))\n",
42-
" length_description = 'short'"
42+
" length_description = \"short\""
4343
]
4444
},
4545
{
@@ -50,7 +50,7 @@
5050
},
5151
"outputs": [],
5252
"source": [
53-
"assert length_description == 'semi short'"
53+
"assert length_description == \"semi short\""
5454
]
5555
}
5656
],

notebooks/beginner/exercises/lists_exercise.ipynb renamed to notebooks/beginner/exercises/04_lists_exercise.ipynb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"my_list = ____\n",
1919
"\n",
2020
"# Let's add some values\n",
21-
"my_list.____('Python')\n",
22-
"my_list.____('is ok')\n",
23-
"my_list.____('sometimes')\n",
21+
"my_list.____(\"Python\")\n",
22+
"my_list.____(\"is ok\")\n",
23+
"my_list.____(\"sometimes\")\n",
2424
"\n",
2525
"# Let's remove 'sometimes'\n",
26-
"my_list.____('sometimes')\n",
26+
"my_list.____(\"sometimes\")\n",
2727
"\n",
2828
"# Let's change the second item\n",
29-
"my_list[____] = 'is neat'"
29+
"my_list[____] = \"is neat\""
3030
]
3131
},
3232
{
@@ -38,7 +38,7 @@
3838
"outputs": [],
3939
"source": [
4040
"# Let's verify that it's correct\n",
41-
"assert my_list == ['Python', 'is neat']"
41+
"assert my_list == [\"Python\", \"is neat\"]"
4242
]
4343
},
4444
{
@@ -56,7 +56,7 @@
5656
},
5757
"outputs": [],
5858
"source": [
59-
"original = ['I', 'am', 'learning', 'hacking', 'in']"
59+
"original = [\"I\", \"am\", \"learning\", \"hacking\", \"in\"]"
6060
]
6161
},
6262
{
@@ -77,8 +77,8 @@
7777
},
7878
"outputs": [],
7979
"source": [
80-
"assert original == ['I', 'am', 'learning', 'hacking', 'in']\n",
81-
"assert modified == ['I', 'am', 'learning', 'lists', 'in', 'Python']"
80+
"assert original == [\"I\", \"am\", \"learning\", \"hacking\", \"in\"]\n",
81+
"assert modified == [\"I\", \"am\", \"learning\", \"lists\", \"in\", \"Python\"]"
8282
]
8383
},
8484
{
@@ -115,8 +115,7 @@
115115
"cell_type": "code",
116116
"execution_count": null,
117117
"metadata": {
118-
"editable": false,
119-
"scrolled": true
118+
"editable": false
120119
},
121120
"outputs": [],
122121
"source": [

notebooks/beginner/exercises/dictionaries_exercise.ipynb renamed to notebooks/beginner/exercises/05_dictionaries_exercise.ipynb

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
},
1717
"outputs": [],
1818
"source": [
19-
"first_name = 'John'\n",
20-
"last_name = 'Doe'\n",
21-
"favorite_hobby = 'Python'\n",
22-
"sports_hobby = 'gym'\n",
19+
"first_name = \"John\"\n",
20+
"last_name = \"Doe\"\n",
21+
"favorite_hobby = \"Python\"\n",
22+
"sports_hobby = \"gym\"\n",
2323
"age = 82"
2424
]
2525
},
@@ -41,11 +41,7 @@
4141
},
4242
"outputs": [],
4343
"source": [
44-
"assert my_dict == {\n",
45-
" 'name': 'John Doe',\n",
46-
" 'age': 82,\n",
47-
" 'hobbies': ['Python', 'gym']\n",
48-
" }"
44+
"assert my_dict == {\"name\": \"John Doe\", \"age\": 82, \"hobbies\": [\"Python\", \"gym\"]}"
4945
]
5046
},
5147
{
@@ -64,10 +60,10 @@
6460
},
6561
"outputs": [],
6662
"source": [
67-
"dict1 = dict(key1='This is not that hard', key2='Python is still cool')\n",
68-
"dict2 = {'key1': 123, 'special_key': 'secret'}\n",
69-
"# This is also a away to initialize a dict (list of tuples) \n",
70-
"dict3 = dict([('key2', 456), ('keyX', 'X')])"
63+
"dict1 = dict(key1=\"This is not that hard\", key2=\"Python is still cool\")\n",
64+
"dict2 = {\"key1\": 123, \"special_key\": \"secret\"}\n",
65+
"# This is also a away to initialize a dict (list of tuples)\n",
66+
"dict3 = dict([(\"key2\", 456), (\"keyX\", \"X\")])"
7167
]
7268
},
7369
{
@@ -89,16 +85,13 @@
8985
},
9086
"outputs": [],
9187
"source": [
92-
"assert my_dict == {'key1': 123, 'key2': 456, 'keyX': 'X'}\n",
93-
"assert special_value == 'secret'\n",
88+
"assert my_dict == {\"key1\": 123, \"key2\": 456, \"keyX\": \"X\"}\n",
89+
"assert special_value == \"secret\"\n",
9490
"\n",
9591
"# Let's check that the originals are untouched\n",
96-
"assert dict1 == {\n",
97-
" 'key1': 'This is not that hard',\n",
98-
" 'key2': 'Python is still cool'\n",
99-
" }\n",
100-
"assert dict2 == {'key1': 123, 'special_key': 'secret'}\n",
101-
"assert dict3 == {'key2': 456, 'keyX': 'X'}"
92+
"assert dict1 == {\"key1\": \"This is not that hard\", \"key2\": \"Python is still cool\"}\n",
93+
"assert dict2 == {\"key1\": 123, \"special_key\": \"secret\"}\n",
94+
"assert dict3 == {\"key2\": 456, \"keyX\": \"X\"}"
10295
]
10396
}
10497
],

notebooks/beginner/exercises/for_loops_exercise.ipynb renamed to notebooks/beginner/exercises/06_for_loops_exercise.ipynb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"metadata": {},
1515
"outputs": [],
1616
"source": [
17-
"words = ['PYTHON', 'JOHN', 'chEEse', 'hAm', 'DOE', '123']\n",
17+
"words = [\"PYTHON\", \"JOHN\", \"chEEse\", \"hAm\", \"DOE\", \"123\"]\n",
1818
"upper_case_words = []\n",
1919
"\n",
2020
"for ____ in words:\n",
@@ -30,7 +30,7 @@
3030
},
3131
"outputs": [],
3232
"source": [
33-
"assert upper_case_words == ['PYTHON', 'JOHN', 'DOE']"
33+
"assert upper_case_words == [\"PYTHON\", \"JOHN\", \"DOE\"]"
3434
]
3535
},
3636
{
@@ -49,7 +49,7 @@
4949
},
5050
"outputs": [],
5151
"source": [
52-
"magic_dict = dict(val1=44, val2='secret value', val3=55.0, val4=1)"
52+
"magic_dict = dict(val1=44, val2=\"secret value\", val3=55.0, val4=1)"
5353
]
5454
},
5555
{
@@ -114,7 +114,16 @@
114114
},
115115
"outputs": [],
116116
"source": [
117-
"assert my_list == ['odd', 'odd', 'even', 'even', 'odd', 'five even', 'five even', 'five odd']"
117+
"assert my_list == [\n",
118+
" \"odd\",\n",
119+
" \"odd\",\n",
120+
" \"even\",\n",
121+
" \"even\",\n",
122+
" \"odd\",\n",
123+
" \"five even\",\n",
124+
" \"five even\",\n",
125+
" \"five odd\",\n",
126+
"]"
118127
]
119128
}
120129
],

notebooks/beginner/exercises/functions_exercise.ipynb renamed to notebooks/beginner/exercises/07_functions_exercise.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54-
"WANTED_PEOPLE = ['John Doe', 'Clint Eastwood', 'Chuck Norris']"
54+
"WANTED_PEOPLE = [\"John Doe\", \"Clint Eastwood\", \"Chuck Norris\"]"
5555
]
5656
},
5757
{
@@ -71,13 +71,13 @@
7171
},
7272
"outputs": [],
7373
"source": [
74-
"people_to_check1 = ['Donald Duck', 'Clint Eastwood', 'John Doe', 'Barack Obama']\n",
74+
"people_to_check1 = [\"Donald Duck\", \"Clint Eastwood\", \"John Doe\", \"Barack Obama\"]\n",
7575
"wanted1 = find_wanted_people(people_to_check1)\n",
7676
"assert len(wanted1) == 2\n",
77-
"assert 'John Doe' in wanted1\n",
78-
"assert 'Clint Eastwood'in wanted1\n",
77+
"assert \"John Doe\" in wanted1\n",
78+
"assert \"Clint Eastwood\" in wanted1\n",
7979
"\n",
80-
"people_to_check2 = ['Donald Duck', 'Mickey Mouse', 'Zorro', 'Superman', 'Robin Hood']\n",
80+
"people_to_check2 = [\"Donald Duck\", \"Mickey Mouse\", \"Zorro\", \"Superman\", \"Robin Hood\"]\n",
8181
"wanted2 = find_wanted_people(people_to_check2)\n",
8282
"assert wanted2 == []"
8383
]
@@ -107,10 +107,10 @@
107107
},
108108
"outputs": [],
109109
"source": [
110-
"assert average_length_of_words('only four lett erwo rdss') == 4\n",
111-
"assert average_length_of_words('one two three') == 3.7\n",
112-
"assert average_length_of_words('one two three four') == 3.8\n",
113-
"assert average_length_of_words('') == 0"
110+
"assert average_length_of_words(\"only four lett erwo rdss\") == 4\n",
111+
"assert average_length_of_words(\"one two three\") == 3.7\n",
112+
"assert average_length_of_words(\"one two three four\") == 3.8\n",
113+
"assert average_length_of_words(\"\") == 0"
114114
]
115115
}
116116
],

notebooks/beginner/exercises/testing1_exercise.ipynb renamed to notebooks/beginner/exercises/08_testing1_exercise.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
"source": [
99
"# Required boilerplate\n",
1010
"import sys\n",
11+
"\n",
1112
"!{sys.executable} -m pip install pytest\n",
1213
"!{sys.executable} -m pip install ipytest\n",
1314
"\n",
1415
"import ipytest.magics\n",
1516
"import pytest\n",
1617
"\n",
17-
"__file__ = 'testing1_exercise.ipynb'"
18+
"__file__ = \"testing1_exercise.ipynb\""
1819
]
1920
},
2021
{
@@ -34,7 +35,7 @@
3435
"outputs": [],
3536
"source": [
3637
"def get_divisible_by_five(numbers):\n",
37-
" '''Returns a list of numbers which are divisible by five in the list got as an argument'''\n",
38+
" \"\"\"Returns a list of numbers which are divisible by five in the list got as an argument\"\"\"\n",
3839
" result = []\n",
3940
" for num in numbers:\n",
4041
" if not num % 5:\n",

0 commit comments

Comments
 (0)