From f061c6bc1a5dbfb5ba7cf75d3acc4fa7fdca6d53 Mon Sep 17 00:00:00 2001 From: Joseph Hauser Date: Tue, 10 Mar 2026 20:54:06 +0100 Subject: [PATCH] completed question 1 --- lab-python-data-structures.ipynb | 34 +++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 8ba652c..684405b 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -57,11 +57,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15\n", + "[1, 3, 5]\n", + "[1, 3, 5]\n" + ] + } + ], "source": [ - "# Your code here" + "# Your code here\n", + "students = [\"Abby\", \"Brian\", \"Cathy\", \"Durian\", \"Emmanuel\"]\n", + "grades = []\n", + "sum = 0\n", + "for student in students:\n", + " grade = int(input(\"what is \" +student+ \"'s grade?\"))\n", + " grades.append(grade)\n", + " sum += grade\n", + "print(sum)\n", + "# print(grades[0:5:2])\n", + "new_list = grades[0:5:2]\n", + "print(new_list)\n", + "new_list_sorted = sorted(new_list)\n", + "print(new_list_sorted)\n", + "\n" ] }, { @@ -285,7 +309,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -299,7 +323,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.11.5" } }, "nbformat": 4,