Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Oct 8, 2019
1 parent b5ef9d7 commit f139e11
Show file tree
Hide file tree
Showing 9 changed files with 355 additions and 109 deletions.
16 changes: 8 additions & 8 deletions exercises/basics/basics-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"output_type": "stream",
"text": [
"<class 'int'>\n",
"94383670563968\n"
"94659737478272\n"
]
}
],
Expand All @@ -162,8 +162,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"value: 4 type: <class 'int'> id: 94383670563968\n",
"value: 5 type: <class 'int'> id: 94383670564000\n"
"value: 4 type: <class 'int'> id: 94659737478272\n",
"value: 5 type: <class 'int'> id: 94659737478304\n"
]
}
],
Expand Down Expand Up @@ -194,8 +194,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"value: 4 type: <class 'int'> id: 94383670563968\n",
"value: four type: <class 'str'> id: 139792032191576\n"
"value: 4 type: <class 'int'> id: 94659737478272\n",
"value: four type: <class 'str'> id: 140605610986440\n"
]
}
],
Expand Down Expand Up @@ -234,7 +234,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Exercise: variable names\n",
"### Exercise: variable names\n",
"\n",
"For each of the following names, try to guess if it is a valid _variable name_ or not, then try to assign it in following cell\n",
"\n",
Expand Down Expand Up @@ -474,7 +474,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Booleans exercise: constants \n",
"### Booleans exercise: constants \n",
"\n",
"Try to guess the result of these boolean expressions (_first_ guess, and _then_ try it out !!)\n"
]
Expand Down Expand Up @@ -604,7 +604,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Booleans exercise: what is a boolean?\n",
"### Booleans exercise: what is a boolean?\n",
"\n",
"Read carefully previous description of booleans, and try to guess the result of following expressions."
]
Expand Down
30 changes: 30 additions & 0 deletions exercises/dictionaries/dictionaries-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,36 @@
"d"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dictionary methods\n",
"\n",
"Recall what seen in the lecture, the following methods are available for dictionaries:\n",
"\n",
"![](img/methods.png)\n",
"\n",
"These methods are new to dictionaries and can be used to loop through the elements in them.\n",
"\n",
"<div class=\"alert alert-warning\">\n",
"\n",
"**ATTENTION:** ```dict.keys()``` returns a ```dict_keys``` object not a list. To cast it to list, we need to call ```list(dict.keys())```.\n",
"\n",
"</div>\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Functions working on dictionaries\n",
"\n",
"As for the other data types, python provides several operators that can be applied to dictionaries. The following operators are available and they basically work as in lists. The only exception being that the operator **in** checks whether the specified object is present among the **keys**.\n",
"\n",
"![](img/operators.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Binary file added exercises/dictionaries/img/methods.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/dictionaries/img/operators.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f139e11

Please sign in to comment.