From 61ca52a4d1badaa2f08e6842b3343b6d1be39fae Mon Sep 17 00:00:00 2001 From: JacobBenSchwartz Date: Wed, 29 Jan 2025 15:31:32 +0000 Subject: [PATCH 1/5] Participated in classwork. --- lists.ipynb | 494 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 412 insertions(+), 82 deletions(-) diff --git a/lists.ipynb b/lists.ipynb index 28ed228..9cb71c6 100644 --- a/lists.ipynb +++ b/lists.ipynb @@ -36,9 +36,17 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Alcman', 'Sappho', 'Alcaeus', 'Anacreon', 'Stesichorus', 'Ibycus', 'Simonides', 'Bacchylides', 'Pindar']\n" + ] + } + ], "source": [ "print(lyric_poets)" ] @@ -52,11 +60,30 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "lyric_poets" + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Alcman',\n", + " 'Sappho',\n", + " 'Alcaeus',\n", + " 'Anacreon',\n", + " 'Stesichorus',\n", + " 'Ibycus',\n", + " 'Simonides',\n", + " 'Bacchylides',\n", + " 'Pindar']" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lyric_poets " ] }, { @@ -70,9 +97,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Alcman'" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[0]" ] @@ -86,9 +124,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "type(lyric_poets[0])" ] @@ -102,18 +151,40 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'alcman'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[0].lower()" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'ALCMAN'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[0].upper()" ] @@ -127,9 +198,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Pindar'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[8]" ] @@ -143,9 +225,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Pindar'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[len(lyric_poets) - 1]" ] @@ -159,9 +252,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Pindar'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[-1]" ] @@ -175,9 +279,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Bacchylides'" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[-2]" ] @@ -200,9 +315,28 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Alkman',\n", + " 'Sappho',\n", + " 'Alcaeus',\n", + " 'Anacreon',\n", + " 'Stesichorus',\n", + " 'Ibycus',\n", + " 'Simonides',\n", + " 'Bacchylides',\n", + " 'Pindar']" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets[0] = 'Alkman'\n", "lyric_poets" @@ -217,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -226,9 +360,30 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Alkman',\n", + " 'Sappho',\n", + " 'Alcaeus',\n", + " 'Anacreon',\n", + " 'Stesichorus',\n", + " 'Ibycus',\n", + " 'Simonides',\n", + " 'Bacchylides',\n", + " 'Pindar',\n", + " 'Horace',\n", + " 'Horace']" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets" ] @@ -242,9 +397,31 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Alkman',\n", + " 'Sappho',\n", + " 'Alcaeus',\n", + " 'Anacreon',\n", + " 'Ovid',\n", + " 'Stesichorus',\n", + " 'Ibycus',\n", + " 'Simonides',\n", + " 'Bacchylides',\n", + " 'Pindar',\n", + " 'Horace',\n", + " 'Horace']" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets.insert(4, \"Ovid\")\n", "lyric_poets" @@ -259,9 +436,32 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['Alkman',\n", + " 'Sappho',\n", + " 'Alcaeus',\n", + " 'Anacreon',\n", + " 'Ovid',\n", + " 'Stesichorus',\n", + " 'Ibycus',\n", + " 'Simonides',\n", + " 'Bacchylides',\n", + " 'Pindar',\n", + " 'Horace',\n", + " 'Horace',\n", + " 'Homer']" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lyric_poets.append(\"Homer\")\n", "lyric_poets" @@ -276,7 +476,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -296,9 +496,18 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I most recently taught in S2022.\n", + "I also taught in F2018, S2019, F2019, S2020, F2021.\n" + ] + } + ], "source": [ "teaching_semesters = [\"F2018\", \"S2019\", \"F2019\", \"S2020\", \"F2021\", \"S2022\"]\n", "\n", @@ -324,9 +533,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['F2018', 'S2019', 'F2019', 'S2020', 'F2021']" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "teaching_semesters" ] @@ -340,18 +560,41 @@ }, { "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [], + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "list.remove(x): x not in list", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[42], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mteaching_semesters\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mS2020\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# partially online due to Covid\u001b[39;00m\n", + "\u001b[0;31mValueError\u001b[0m: list.remove(x): x not in list" + ] + } + ], "source": [ "teaching_semesters.remove(\"S2020\") # partially online due to Covid" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['F2018', 'S2019', 'F2019', 'F2021']" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "teaching_semesters" ] @@ -374,9 +617,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[3, 4, 1, 5, -1, 8]" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "my_list = [3, 4, 1, 5, -1, 8]\n", "my_list" @@ -384,9 +638,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[-1, 1, 3, 4, 5, 8]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "my_list.sort()\n", "my_list" @@ -401,9 +666,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[3, 4, 1, 5, -1, 8]" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "my_list = [3, 4, 1, 5, -1, 8]\n", "my_list" @@ -411,9 +687,18 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[-1, 1, 3, 4, 5, 8]\n", + "[3, 4, 1, 5, -1, 8]\n" + ] + } + ], "source": [ "print(sorted(my_list))\n", "print(my_list)" @@ -430,9 +715,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[8, -1, 5, 1, 4, 3]" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "my_list.reverse()\n", "my_list" @@ -454,9 +750,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "len(my_list)" ] @@ -472,9 +779,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[49], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mmy_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m6\u001b[39;49m\u001b[43m]\u001b[49m\n", + "\u001b[0;31mIndexError\u001b[0m: list index out of range" + ] + } + ], "source": [ "my_list[6]" ] @@ -488,9 +807,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "my_list[5]" ] @@ -514,7 +844,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -528,7 +858,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.7" + "version": "3.12.1" } }, "nbformat": 4, From 95b74c0cfc4556822b94734bd516fad1f1bbdb64 Mon Sep 17 00:00:00 2001 From: JacobBenSchwartz Date: Wed, 29 Jan 2025 16:18:41 +0000 Subject: [PATCH 2/5] Re-ran all code. --- lists.ipynb | 119 +++++++++++++++++++++++----------------------------- 1 file changed, 52 insertions(+), 67 deletions(-) diff --git a/lists.ipynb b/lists.ipynb index 9cb71c6..ec911da 100644 --- a/lists.ipynb +++ b/lists.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -36,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -60,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -77,7 +77,7 @@ " 'Pindar']" ] }, - "execution_count": 7, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -97,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -106,7 +106,7 @@ "'Alcman'" ] }, - "execution_count": 8, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -124,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -133,7 +133,7 @@ "str" ] }, - "execution_count": 9, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -151,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -160,7 +160,7 @@ "'alcman'" ] }, - "execution_count": 10, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -171,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -180,7 +180,7 @@ "'ALCMAN'" ] }, - "execution_count": 11, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -207,7 +207,7 @@ "'Pindar'" ] }, - "execution_count": 12, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -234,7 +234,7 @@ "'Pindar'" ] }, - "execution_count": 13, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -252,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -261,7 +261,7 @@ "'Pindar'" ] }, - "execution_count": 14, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -279,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -288,7 +288,7 @@ "'Bacchylides'" ] }, - "execution_count": 15, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -315,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -332,7 +332,7 @@ " 'Pindar']" ] }, - "execution_count": 16, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -351,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -360,7 +360,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -375,11 +375,10 @@ " 'Simonides',\n", " 'Bacchylides',\n", " 'Pindar',\n", - " 'Horace',\n", " 'Horace']" ] }, - "execution_count": 20, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -397,7 +396,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -413,11 +412,10 @@ " 'Simonides',\n", " 'Bacchylides',\n", " 'Pindar',\n", - " 'Horace',\n", " 'Horace']" ] }, - "execution_count": 21, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -436,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -453,11 +451,10 @@ " 'Bacchylides',\n", " 'Pindar',\n", " 'Horace',\n", - " 'Horace',\n", " 'Homer']" ] }, - "execution_count": 22, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -476,7 +473,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -496,7 +493,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -533,7 +530,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -542,7 +539,7 @@ "['F2018', 'S2019', 'F2019', 'S2020', 'F2021']" ] }, - "execution_count": 40, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -560,28 +557,16 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 3, "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "list.remove(x): x not in list", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[42], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mteaching_semesters\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mS2020\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# partially online due to Covid\u001b[39;00m\n", - "\u001b[0;31mValueError\u001b[0m: list.remove(x): x not in list" - ] - } - ], + "outputs": [], "source": [ "teaching_semesters.remove(\"S2020\") # partially online due to Covid" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -590,7 +575,7 @@ "['F2018', 'S2019', 'F2019', 'F2021']" ] }, - "execution_count": 29, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -617,7 +602,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -626,7 +611,7 @@ "[3, 4, 1, 5, -1, 8]" ] }, - "execution_count": 43, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -638,7 +623,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -647,7 +632,7 @@ "[-1, 1, 3, 4, 5, 8]" ] }, - "execution_count": 44, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -666,7 +651,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -675,7 +660,7 @@ "[3, 4, 1, 5, -1, 8]" ] }, - "execution_count": 45, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -687,7 +672,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -715,7 +700,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -724,7 +709,7 @@ "[8, -1, 5, 1, 4, 3]" ] }, - "execution_count": 47, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -750,7 +735,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -759,7 +744,7 @@ "6" ] }, - "execution_count": 48, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -779,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -789,7 +774,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[49], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mmy_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m6\u001b[39;49m\u001b[43m]\u001b[49m\n", + "Cell \u001b[0;32mIn[30], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mmy_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m6\u001b[39;49m\u001b[43m]\u001b[49m\n", "\u001b[0;31mIndexError\u001b[0m: list index out of range" ] } @@ -807,7 +792,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -816,7 +801,7 @@ "3" ] }, - "execution_count": 50, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } From ceeae9eca1be8a5e70583883ef1df1a0f56eb824 Mon Sep 17 00:00:00 2001 From: JacobBenSchwartz Date: Sun, 2 Feb 2025 21:40:46 +0000 Subject: [PATCH 3/5] Completed exercises 3-8, p.45. --- lists.ipynb | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/lists.ipynb b/lists.ipynb index ec911da..0d68e5c 100644 --- a/lists.ipynb +++ b/lists.ipynb @@ -825,6 +825,172 @@ "\n", "Complete Exercise 3-8 in Matthes (2023, p. 45)." ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "destinations = [\"greece\", \"turkey\", \"japan\", \"germany\", \"new zealand\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']\n" + ] + } + ], + "source": [ + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['germany', 'greece', 'japan', 'new zealand', 'turkey']\n" + ] + } + ], + "source": [ + "print(sorted(destinations))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']\n" + ] + } + ], + "source": [ + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['turkey', 'new zealand', 'japan', 'greece', 'germany']\n" + ] + } + ], + "source": [ + "print(sorted(destinations, reverse=True))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']\n" + ] + } + ], + "source": [ + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['new zealand', 'germany', 'japan', 'turkey', 'greece']\n" + ] + } + ], + "source": [ + "destinations.reverse()\n", + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']\n" + ] + } + ], + "source": [ + "destinations.reverse()\n", + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['germany', 'greece', 'japan', 'new zealand', 'turkey']\n" + ] + } + ], + "source": [ + "destinations.sort()\n", + "print(destinations)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['turkey', 'new zealand', 'japan', 'greece', 'germany']\n" + ] + } + ], + "source": [ + "destinations.sort(reverse=True)\n", + "print(destinations)" + ] } ], "metadata": { From 006903cb2169783d3ce097219fa8149c5e32865d Mon Sep 17 00:00:00 2001 From: JacobBenSchwartz Date: Mon, 3 Feb 2025 14:16:53 +0000 Subject: [PATCH 4/5] Added a little to try to commit. --- lists.ipynb | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lists.ipynb b/lists.ipynb index 0d68e5c..b7e805d 100644 --- a/lists.ipynb +++ b/lists.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -36,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -828,7 +828,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -991,6 +991,27 @@ "destinations.sort(reverse=True)\n", "print(destinations)" ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "destinations.reverse()\n", + "destinations " + ] } ], "metadata": { From bd054333fb2b9cf880e5d49d8552383307e7b2b6 Mon Sep 17 00:00:00 2001 From: JacobBenSchwartz Date: Mon, 3 Feb 2025 14:26:49 +0000 Subject: [PATCH 5/5] Added one more line to get error message again. --- lists.ipynb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lists.ipynb b/lists.ipynb index b7e805d..5056231 100644 --- a/lists.ipynb +++ b/lists.ipynb @@ -828,7 +828,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -1012,6 +1012,26 @@ "destinations.reverse()\n", "destinations " ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['greece', 'turkey', 'japan', 'germany', 'new zealand']" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "destinations" + ] } ], "metadata": {