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
314 changes: 291 additions & 23 deletions lists.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,9 +36,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Alcman', 'Sappho', 'Alcaeus', 'Anacreon', 'Stesichorus', 'Ibycus', 'Simonides', 'Bacchylides', 'Pindar']\n"
]
}
],
"source": [
"print(lyric_poets)"
]
Expand All @@ -52,9 +60,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Alcman',\n",
" 'Sappho',\n",
" 'Alcaeus',\n",
" 'Anacreon',\n",
" 'Stesichorus',\n",
" 'Ibycus',\n",
" 'Simonides',\n",
" 'Bacchylides',\n",
" 'Pindar']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lyric_poets"
]
Expand All @@ -70,9 +97,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Alcman'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lyric_poets[0]"
]
Expand All @@ -86,9 +124,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"str"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(lyric_poets[0])"
]
Expand All @@ -102,18 +151,40 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'alcman'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lyric_poets[0].lower()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'ALCMAN'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lyric_poets[0].upper()"
]
Expand All @@ -127,9 +198,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'lyric_poets' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mlyric_poets\u001b[49m[\u001b[38;5;241m8\u001b[39m]\n",
"\u001b[0;31mNameError\u001b[0m: name 'lyric_poets' is not defined"
]
}
],
"source": [
"lyric_poets[8]"
]
Expand Down Expand Up @@ -510,11 +593,196 @@
"\n",
"Complete Exercise 3-8 in Matthes (2023, p. 45)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Japan', 'South Korea', 'Kazakhstan', 'Serbia', 'Germany']"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit = [\"Japan\", \"South Korea\", \"Kazakhstan\", \"Serbia\", \"Germany\"]\n",
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Germany', 'Japan', 'Kazakhstan', 'Serbia', 'South Korea']"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sorted(to_visit)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Japan', 'South Korea', 'Kazakhstan', 'Serbia', 'Germany']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['South Korea', 'Serbia', 'Kazakhstan', 'Japan', 'Germany']"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sorted(to_visit, reverse = True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Japan', 'South Korea', 'Kazakhstan', 'Serbia', 'Germany']"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Germany', 'Serbia', 'Kazakhstan', 'South Korea', 'Japan']"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit.reverse()\n",
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Japan', 'South Korea', 'Kazakhstan', 'Serbia', 'Germany']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit.reverse()\n",
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Germany', 'Japan', 'Kazakhstan', 'Serbia', 'South Korea']"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit.sort()\n",
"to_visit"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['South Korea', 'Serbia', 'Kazakhstan', 'Japan', 'Germany']"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"to_visit.sort(reverse = True)\n",
"to_visit"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -528,7 +796,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down