Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 137 additions & 5 deletions lists.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -60,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -77,7 +77,7 @@
" 'Pindar']"
]
},
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -119,7 +119,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"What is the `type` of `lyric_poets[0]`?"
"What is the `type` of `lyric_poets[0]`?\n",
"str"
]
},
{
Expand Down Expand Up @@ -1019,6 +1020,137 @@
"\n",
"Complete Exercise 3-8 in Matthes (2023, p. 45)."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Paris', 'Beijing', 'Lima', 'Auckland', 'Nouakchott']\n"
]
}
],
"source": [
"interesting_places = [\"Paris\", \"Beijing\", \"Lima\", \"Auckland\", \"Nouakchott\"]\n",
"print (interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Auckland', 'Beijing', 'Lima', 'Nouakchott', 'Paris']\n",
"['Paris', 'Beijing', 'Lima', 'Auckland', 'Nouakchott']\n"
]
}
],
"source": [
"print(sorted(interesting_places))\n",
"print(interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Paris', 'Nouakchott', 'Lima', 'Beijing', 'Auckland']\n",
"['Paris', 'Beijing', 'Lima', 'Auckland', 'Nouakchott']\n"
]
}
],
"source": [
"print(sorted(interesting_places, reverse=True))\n",
"print(interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"['Nouakchott', 'Auckland', 'Lima', 'Beijing', 'Paris']\n"
]
}
],
"source": [
"print(interesting_places.reverse())\n",
"print(interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"['Paris', 'Beijing', 'Lima', 'Auckland', 'Nouakchott']\n"
]
}
],
"source": [
"print(interesting_places.reverse())\n",
"print(interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"['Auckland', 'Beijing', 'Lima', 'Nouakchott', 'Paris']\n"
]
}
],
"source": [
"interesting_places.sort()\n",
"print(interesting_places)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Paris', 'Nouakchott', 'Lima', 'Beijing', 'Auckland']\n"
]
}
],
"source": [
"interesting_places.sort(reverse=True)\n",
"print(interesting_places)"
]
}
],
"metadata": {
Expand Down