From 89ec25ad39eb32f2deb5bdcc3e947e740696af0f Mon Sep 17 00:00:00 2001 From: Ranveer Date: Tue, 26 Nov 2024 19:59:41 -0500 Subject: [PATCH 01/18] Data Type Homework --- 02_activities/homework/01_data_types.ipynb | 241 ++++++++++++++++- Data Type Nov 26.ipynb | 291 +++++++++++++++++++++ 2 files changed, 531 insertions(+), 1 deletion(-) create mode 100644 Data Type Nov 26.ipynb diff --git a/02_activities/homework/01_data_types.ipynb b/02_activities/homework/01_data_types.ipynb index f60123d4b..09bf9a129 100644 --- a/02_activities/homework/01_data_types.ipynb +++ b/02_activities/homework/01_data_types.ipynb @@ -1 +1,240 @@ -{"cells":[{"cell_type":"markdown","metadata":{"id":"jNAI57ELh-I8"},"source":["# Getting Started: Python Fundamentals\n","## Practice Problems"]},{"cell_type":"markdown","metadata":{"id":"5xeRB_0jiT5n"},"source":["### 1. What types are involved in the following expressions? What data type will each expression evaluate to?\n","\n","`8 * 2.5`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":158,"status":"ok","timestamp":1667929890889,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"C6c48sSBOUeE","outputId":"3628ffce-faf6-4d23-daff-5e09edf76541"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"4eICUfHi_Z-K"},"source":["`9 / 2`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":43,"status":"ok","timestamp":1667929891449,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"QVdbNoA2OiQ_","outputId":"ab9f4fac-b1cc-4afc-cc54-10592b92abb1"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"DhrJoWbj_cNe"},"source":["`9 // -2`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":39,"status":"ok","timestamp":1667929891450,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"cSsGq3r0Opx6","outputId":"13df11ef-d136-4a42-884e-be1e369aae52"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"lW4UnVfw_eYy"},"source":["`1.5 * 2 >= 7 - 3`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":34,"status":"ok","timestamp":1667929891452,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"54N6gcNPOylS","outputId":"938208fc-c4c3-4e58-dd18-b50d3acc84d8"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"5T-ytiTw-KvJ"},"source":["### 2. In which order will the expressions be evaluated.\n","\n","`6 * 3 + 7 * 4`\n","\n","\n","
\n"," Answer\n","\n"," `*` > `*` > `+` \n","
\n","\n","\n","`5 - 2 * 3 ** 4`\n","\n","
\n"," Answer\n","\n"," `**` > `*` > `-`\n","
\n","\n","`(5 - 2) * 3 ** 4`\n","\n","
\n"," Answer\n","\n"," `(-)` > `**` > `*` \n","
\n","\n","`5 + 2 >= 3 * 4`\n","\n","
\n"," Answer\n","\n"," `*` > `+` > `>=`\n","
"]}],"metadata":{"colab":{"authorship_tag":"ABX9TyMhUBNX+UP2C+YDtVSxQKBK","collapsed_sections":[],"provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0} +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "jNAI57ELh-I8" + }, + "source": [ + "# Getting Started: Python Fundamentals\n", + "## Practice Problems" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5xeRB_0jiT5n" + }, + "source": [ + "### 1. What types are involved in the following expressions? What data type will each expression evaluate to?\n", + "\n", + "`8 * 2.5`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "executionInfo": { + "elapsed": 158, + "status": "ok", + "timestamp": 1667929890889, + "user": { + "displayName": "Kaylie Lau", + "userId": "01284785813595846851" + }, + "user_tz": 300 + }, + "id": "C6c48sSBOUeE", + "outputId": "3628ffce-faf6-4d23-daff-5e09edf76541" + }, + "outputs": [], + "source": [ + "# 8 is an integer\n", + "# 2.5 is float\n", + "# float\n", + "# 20.0" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "4eICUfHi_Z-K" + }, + "source": [ + "`9 / 2`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "executionInfo": { + "elapsed": 43, + "status": "ok", + "timestamp": 1667929891449, + "user": { + "displayName": "Kaylie Lau", + "userId": "01284785813595846851" + }, + "user_tz": 300 + }, + "id": "QVdbNoA2OiQ_", + "outputId": "ab9f4fac-b1cc-4afc-cc54-10592b92abb1" + }, + "outputs": [], + "source": [ + "# 9 is an integer\n", + "# 2 is an integer\n", + "# / is the division and gives results as float data type\n", + "# 4.5" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "DhrJoWbj_cNe" + }, + "source": [ + "`9 // -2`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "executionInfo": { + "elapsed": 39, + "status": "ok", + "timestamp": 1667929891450, + "user": { + "displayName": "Kaylie Lau", + "userId": "01284785813595846851" + }, + "user_tz": 300 + }, + "id": "cSsGq3r0Opx6", + "outputId": "13df11ef-d136-4a42-884e-be1e369aae52" + }, + "outputs": [], + "source": [ + "# 9 is an integer\n", + "# // is the floor division\n", + "# -2 is an integer\n", + "# the result will be an integer rounded down\n", + "# -5" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lW4UnVfw_eYy" + }, + "source": [ + "`1.5 * 2 >= 7 - 3`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "executionInfo": { + "elapsed": 34, + "status": "ok", + "timestamp": 1667929891452, + "user": { + "displayName": "Kaylie Lau", + "userId": "01284785813595846851" + }, + "user_tz": 300 + }, + "id": "54N6gcNPOylS", + "outputId": "938208fc-c4c3-4e58-dd18-b50d3acc84d8" + }, + "outputs": [], + "source": [ + "# 1.5 is float\n", + "# * is multiplication\n", + "# 2, 7, 3 are integers\n", + "# >= is greater than equal to\n", + "# - substraction\n", + "# result will be Boolean (FALSE)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5T-ytiTw-KvJ" + }, + "source": [ + "### 2. In which order will the expressions be evaluated.\n", + "\n", + "`6 * 3 + 7 * 4`\n", + "\n", + "\n", + "
\n", + " Answer\n", + "\n", + " `*` > `*` > `+` \n", + "
\n", + "\n", + "\n", + "`5 - 2 * 3 ** 4`\n", + "\n", + "
\n", + " Answer\n", + "\n", + " `**` > `*` > `-`\n", + "
\n", + "\n", + "`(5 - 2) * 3 ** 4`\n", + "\n", + "
\n", + " Answer\n", + "\n", + " `(-)` > `**` > `*` \n", + "
\n", + "\n", + "`5 + 2 >= 3 * 4`\n", + "\n", + "
\n", + " Answer\n", + "\n", + " `*` > `+` > `>=`\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 6 * 3, 7 * 4, 18 + 28 \n", + "# = 46\n", + "# 3 ** 4 (81), 2 * 81 (162), 5 - 162 \n", + "# = -157\n", + "# (5-2), 3 ** 4, 3 * 81 \n", + "# = 243\n", + "# 3 * 4, 5 + 2 \n", + "# FALSE" + ] + } + ], + "metadata": { + "colab": { + "authorship_tag": "ABX9TyMhUBNX+UP2C+YDtVSxQKBK", + "collapsed_sections": [], + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Data Type Nov 26.ipynb b/Data Type Nov 26.ipynb new file mode 100644 index 000000000..3863f85b5 --- /dev/null +++ b/Data Type Nov 26.ipynb @@ -0,0 +1,291 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# November 26th, 2024" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world\n" + ] + } + ], + "source": [ + "print(\"hello world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "4+2" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-5" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9 // -2" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1.5 * 2 >= 7 - 3" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "46" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "6 * 3 + 7 * 4" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-157" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5 - 2 * 3 ** 4" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "243" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(5-2)* 3 ** 4" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9//5\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.8" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9/5" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "def c_to_f(degrees_c):\n", + " degrees_f = (9/5) * degrees_c + 32\n", + " return degrees_f" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "50.0" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c_to_f(10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "dsi_participant", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.15" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From 75188fce415a2491ccc658e8b371354ae16268ed Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 16:43:04 -0500 Subject: [PATCH 02/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 108 ++++++++++++++++--- 1 file changed, 95 insertions(+), 13 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index cbfd8c709..8d4e0753a 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -58,30 +58,73 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# This is a function, which we will learn more about next week. For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", - " # Your code here\n", + "\n", + " # using list function to create a list of each letter in the word_a & word_b\n", + " # using string.lower() method to change the string to lowercase.\n", + " # sort function will sort the alphabets in ascending order which is default\n", + " alphabet_list_a = list(word_a.lower())\n", + " alphabet_list_a.sort()\n", + " alphabet_list_b = list(word_b.lower())\n", + " alphabet_list_b.sort()\n", + "\n", + " # == is for comparing two lists. It compares two lists elementwise. \n", + " return(alphabet_list_a == alphabet_list_b)\n", "\n", "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\")" + "anagram_checker(\"Silent\", \"listen\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"Night\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"night\", \"Thing\")" ] @@ -99,10 +142,38 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - " # Modify your existing code here\n", + "\n", + "# I'll use if else to set the conditions about the case sensitivity\n", + " if is_case_sensitive == False:\n", + "\n", + " alphabet_list_a = list(word_a.lower())\n", + " alphabet_list_a.sort()\n", + " alphabet_list_b = list(word_b.lower())\n", + " alphabet_list_b.sort()\n", + "\n", + " return(alphabet_list_a == alphabet_list_b)\n", + "\n", + " else:\n", + " alphabet_list_a = list(word_a)\n", + " alphabet_list_a.sort()\n", + " alphabet_list_b = list(word_b)\n", + " alphabet_list_b.sort()\n", + "\n", + " return(alphabet_list_a == alphabet_list_b)\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -110,9 +181,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] @@ -130,7 +212,7 @@ ], "metadata": { "kernelspec": { - "display_name": "new-learner", + "display_name": "dsi_participant", "language": "python", "name": "python3" }, @@ -144,7 +226,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.9.15" } }, "nbformat": 4, From 32c2b6bf1f0c1a54f0bb2a986e0f25d772a8fd0a Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:04:33 -0500 Subject: [PATCH 03/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 8d4e0753a..52cdc5395 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -65,7 +65,7 @@ "True" ] }, - "execution_count": 17, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -76,7 +76,7 @@ "\n", " # using list function to create a list of each letter in the word_a & word_b\n", " # using string.lower() method to change the string to lowercase.\n", - " # sort function will sort the alphabets in ascending order which is default\n", + " # sort function will sort the alphabets in ascending order which is default. It modifies the elements in a list and doesn't return the sorted list.\n", " alphabet_list_a = list(word_a.lower())\n", " alphabet_list_a.sort()\n", " alphabet_list_b = list(word_b.lower())\n", @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -100,7 +100,7 @@ "False" ] }, - "execution_count": 18, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -111,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -120,7 +120,7 @@ "True" ] }, - "execution_count": 19, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -140,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -149,7 +149,7 @@ "True" ] }, - "execution_count": 24, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -157,9 +157,9 @@ "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", "\n", - "# I'll use if else to set the conditions about the case sensitivity\n", + "# Using if else to set the conditions about the case sensitivity\n", " if is_case_sensitive == False:\n", - "\n", + " \n", " alphabet_list_a = list(word_a.lower())\n", " alphabet_list_a.sort()\n", " alphabet_list_b = list(word_b.lower())\n", @@ -181,7 +181,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -190,7 +190,7 @@ "False" ] }, - "execution_count": 25, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } From 330944cbaeec649d938ee697f38a16f75eb3cccd Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:29:20 -0500 Subject: [PATCH 04/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 119 +++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 52cdc5395..62d2b9529 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -129,6 +129,50 @@ "anagram_checker(\"night\", \"Thing\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Solution# 2\n", + "Using for loop" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def anagram_checker(word_a, word_b):\n", + " \n", + " alphabet_list_a = []\n", + " word_a = word_a.lower()\n", + " for i in range(0, len(word_a)):\n", + " alphabet_list_a.append(word_a[i])\n", + "\n", + " alphabet_list_b = []\n", + " word_a = word_a.lower()\n", + " for i in range(0, len(word_b)):\n", + " alphabet_list_b.append(word_b[i])\n", + "\n", + " # == is for comparing two lists. It compares two lists elementwise. \n", + " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", + "\n", + "# Run your code to check using the words below:\n", + "anagram_checker(\"Silent\", \"listen\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -199,6 +243,81 @@ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Modifying Solution# 2" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def anagram_checker(word_a, word_b, is_case_sensitive):\n", + "\n", + " if is_case_sensitive == False:\n", + "\n", + " alphabet_list_a = []\n", + " word_a = word_a.lower()\n", + " for i in range(0, len(word_a)):\n", + " alphabet_list_a.append(word_a[i])\n", + "\n", + " alphabet_list_b = []\n", + " word_a = word_a.lower()\n", + " for i in range(0, len(word_b)):\n", + " alphabet_list_b.append(word_b[i])\n", + "\n", + " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", + "\n", + " else:\n", + " alphabet_list_a = []\n", + " for i in range(0, len(word_a)):\n", + " alphabet_list_a.append(word_a[i])\n", + "\n", + " alphabet_list_b = []\n", + " for i in range(0, len(word_b)):\n", + " alphabet_list_b.append(word_b[i])\n", + "\n", + " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", + "\n", + "# Run your code to check using the words below:\n", + "anagram_checker(\"Silent\", \"listen\", False) # True" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"Silent\", \"Listen\", True) # False" + ] + }, { "cell_type": "markdown", "metadata": {}, From 1fc164df623ad2cb1da0eb099589cfa4cbb27b0a Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:31:59 -0500 Subject: [PATCH 05/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 62d2b9529..a7bee0a82 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -139,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -158,11 +158,13 @@ " \n", " alphabet_list_a = []\n", " word_a = word_a.lower()\n", + "\n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", " word_a = word_a.lower()\n", + " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", "\n", @@ -184,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -212,6 +214,7 @@ " return(alphabet_list_a == alphabet_list_b)\n", "\n", " else:\n", + " \n", " alphabet_list_a = list(word_a)\n", " alphabet_list_a.sort()\n", " alphabet_list_b = list(word_b)\n", @@ -252,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -273,11 +276,13 @@ "\n", " alphabet_list_a = []\n", " word_a = word_a.lower()\n", + "\n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", " word_a = word_a.lower()\n", + "\n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", "\n", @@ -285,10 +290,12 @@ "\n", " else:\n", " alphabet_list_a = []\n", + "\n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", + " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", "\n", From bbb3461f5caf90331e017cab44c8be9ad0168908 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:42:05 -0500 Subject: [PATCH 06/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index a7bee0a82..804559dfa 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -156,9 +156,11 @@ "source": [ "def anagram_checker(word_a, word_b):\n", " \n", + " # Creatinig an empty list and changing word_a to lowercase\n", " alphabet_list_a = []\n", " word_a = word_a.lower()\n", "\n", + "# for loop runs from 0 to 5 and adds each letter for the respective index to the updated list in the previous iteration. \n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", @@ -282,20 +284,19 @@ "\n", " alphabet_list_b = []\n", " word_a = word_a.lower()\n", - "\n", + " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", "\n", " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", "\n", " else:\n", - " alphabet_list_a = []\n", "\n", + " alphabet_list_a = []\n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", - " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", "\n", From 8e17c59962722690f5d7e6e472a0563df358f2ba Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:50:00 -0500 Subject: [PATCH 07/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 804559dfa..c48fd76a3 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -160,7 +160,9 @@ " alphabet_list_a = []\n", " word_a = word_a.lower()\n", "\n", - "# for loop runs from 0 to 5 and adds each letter for the respective index to the updated list in the previous iteration. \n", + "# for loop goes through each index of the string (from 0 to (length - 1)) \n", + "# 1. It retrieves the letter at the current index\n", + "# 2. Adds the letter to the list. For each iteration, it keeps adding the letters to the updated list from the previous iteration. \n", " for i in range(0, len(word_a)):\n", " alphabet_list_a.append(word_a[i])\n", "\n", From b06598739f4ff99cb027ed90a2935d5f0004b940 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 17:55:22 -0500 Subject: [PATCH 08/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index c48fd76a3..1c6e6105c 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -65,7 +65,7 @@ "True" ] }, - "execution_count": 26, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -139,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -148,7 +148,7 @@ "True" ] }, - "execution_count": 31, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } From b58150e1d8be1cc281692b34379df3f2cb8434d9 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 28 Nov 2024 18:00:10 -0500 Subject: [PATCH 09/18] Assignment_1 Submission --- 02_activities/assignments/assignment_1.ipynb | 76 +++++++++++++++----- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 1c6e6105c..977dbe1c5 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 56, "metadata": {}, "outputs": [ { @@ -65,7 +65,7 @@ "True" ] }, - "execution_count": 35, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 57, "metadata": {}, "outputs": [ { @@ -100,7 +100,7 @@ "False" ] }, - "execution_count": 27, + "execution_count": 57, "metadata": {}, "output_type": "execute_result" } @@ -111,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 58, "metadata": {}, "outputs": [ { @@ -120,7 +120,7 @@ "True" ] }, - "execution_count": 28, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } @@ -139,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 62, "metadata": {}, "outputs": [ { @@ -148,7 +148,7 @@ "True" ] }, - "execution_count": 42, + "execution_count": 62, "metadata": {}, "output_type": "execute_result" } @@ -167,7 +167,7 @@ " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", - " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", @@ -179,6 +179,46 @@ "anagram_checker(\"Silent\", \"listen\")" ] }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"Silent\", \"Night\")" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"night\", \"Thing\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -190,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 65, "metadata": {}, "outputs": [ { @@ -199,7 +239,7 @@ "True" ] }, - "execution_count": 29, + "execution_count": 65, "metadata": {}, "output_type": "execute_result" } @@ -232,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 66, "metadata": {}, "outputs": [ { @@ -241,7 +281,7 @@ "False" ] }, - "execution_count": 30, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -259,7 +299,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 67, "metadata": {}, "outputs": [ { @@ -268,7 +308,7 @@ "True" ] }, - "execution_count": 33, + "execution_count": 67, "metadata": {}, "output_type": "execute_result" } @@ -285,7 +325,7 @@ " alphabet_list_a.append(word_a[i])\n", "\n", " alphabet_list_b = []\n", - " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", " \n", " for i in range(0, len(word_b)):\n", " alphabet_list_b.append(word_b[i])\n", @@ -310,7 +350,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 68, "metadata": {}, "outputs": [ { @@ -319,7 +359,7 @@ "False" ] }, - "execution_count": 34, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } From aa44ca2c6796dba6304265cb0f03d8dc42da3c05 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 07:32:26 -0500 Subject: [PATCH 10/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 831 +++++++++++-------- 05_src/data/assignment_2_data/small_01.csv | 2 +- provinces.txt | 1 + text.txt | 1 + 4 files changed, 502 insertions(+), 333 deletions(-) create mode 100644 provinces.txt create mode 100644 text.txt diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 482ac53d1..5d663c55d 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -1,339 +1,506 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "QmzeljDgm4Ll" - }, - "source": [ - "# Assignment #2: Efficacy Analysis of a Hypothetical Arthritis Drug\n", - "\n", - "**Objective**: In this assignment, your task is to utilize Python programming skills to evaluate the effectiveness of a fictional medication designed to reduce inflammation caused by arthritis flare-ups.\n", - "\n", - "**Background**: Imagine a clinical trial where 60 patients were administered a new drug for arthritis. Data from this trial has been recorded in a series of CSV files. Evaluate the effectiveness of a fictional medication designed to reduce inflammation caused by arthritis flare-ups.\n", - "\n", - "**Data Structure**:\n", - "- Each CSV file corresponds to a specific check-in session with the patients.\n", - "- There are 12 such CSV files, reflecting 12 different sessions where patients reported their experiences.\n", - "- Inside each file:\n", - " - Rows: Each of the 60 rows represents a unique patient.\n", - " - Columns: Each of the 40 columns corresponds to a day, detailing the number of inflammation flare-ups the patient experienced on that day.\n", - "\n", - "**Your Role**: Analyze this data to determine how effective the new drug has been in managing arthritis inflammation across the trial period." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Submission Information\n", - "\n", - "🚨 **Please review our [Assignment Submission Guide](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md)** 🚨 for detailed instructions on how to format, branch, and submit your work. Following these guidelines is crucial for your submissions to be evaluated correctly.\n", - "\n", - "### Submission Parameters:\n", - "* Submission Due Date: `11:59 PM - Dec 8, 2024`\n", - "* The branch name for your repo should be: `assignment-2`\n", - "* What to submit for this assignment:\n", - " * This Jupyter Notebook (assignment_2.ipynb) should be populated and should be the only change in your pull request.\n", - "* What the pull request link should look like for this assignment: `https://github.com//python/pull/`\n", - " * Open a private window in your browser. Copy and paste the link to your pull request into the address bar. Make sure you can see your pull request properly. This helps the technical facilitator and learning support staff review your submission easily.\n", - "\n", - "Checklist:\n", - "- [ ] Created a branch with the correct naming convention.\n", - "- [ ] Ensured that the repository is public.\n", - "- [ ] Reviewed the PR description guidelines and adhered to them.\n", - "- [ ] Verify that the link is accessible in a private browser window.\n", - "\n", - "If you encounter any difficulties or have questions, please don't hesitate to reach out to our team via our Slack at `#cohort-3-help`. Our Technical Facilitators and Learning Support staff are here to help you navigate any challenges." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "yMsC2qsiKNP8" - }, - "source": [ - "**The file is located under `../05_src/data/assignment_2_data/`.**\n", - "\n", - "The filtered list has been made for you:\n", - "\n", - "```python\n", - "all_paths = [\n", - " \"../05_src/data/assignment_2_data/inflammation_01.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_02.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_03.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_04.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_05.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_06.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_07.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_08.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_09.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_10.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_11.csv\",\n", - " \"../05_src/data/assignment_2_data/inflammation_12.csv\"\n", - "]\n", - "```" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "JhJAJb1m-nkn" - }, - "source": [ - "## 1. Reading and Displaying Data from the First File\n", - "\n", - "With the list of the relevant `inflammation_xx.csv` file paths above, write a program to read the `inflammation_xx.csv` files, and display the contents of the first file in this list.\n", - "\n", - "**Hint**: Remember to use appropriate Python file handling and data reading methods. If you need guidance on how to handle CSV files in Python, refer to the relevant sections in your Python learning resources." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "n0m48JsS-nMC" - }, - "outputs": [], - "source": [ - "with open(all_paths[0], 'r') as f:\n", - " # YOUR CODE HERE: Use the readline() or readlines() method to read the .csv file into 'contents'\n", - " \n", - " # YOUR CODE HERE: Iterate through 'contents' using a for loop and print each row for inspection" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "sacozX7oB1VP" - }, - "source": [ - "## 2. Data Summarization Function: `patient_summary`\n", - "\n", - "Your next step is to create a function named `patient_summary` that will compute summary statistics for each patient's data over a 40-day period.\n", - "\n", - "**Function Specifications**:\n", - "- **Function Name**: `patient_summary`\n", - "- **Parameters**:\n", - " 1. `file_path`: A string representing the path to the CSV file containing the patient data.\n", - " 2. `operation`: A string specifying the type of summary operation to perform. Acceptable values are \"mean\", \"max\", or \"min\". This will determine whether the function calculates the average, maximum, or minimum number of flare-ups for each patient over the 40 days.\n", - "\n", - "**Expected Behavior**:\n", - "- Your function should read the data from the file at `file_path`.\n", - "- Perform the specified `operation` (mean, max, or min) to summarize the flare-ups data for each of the 60 patients.\n", - "- Return an array with 60 elements, each element being the result of the summary operation for a corresponding patient.\n", - "\n", - "**Expected Output**:\n", - "- The output should be an array with a length of 60, aligning with the number of patients in the study.\n", - "\n", - "**Hints for Implementation**:\n", - "1. **Utilizing NumPy**: For efficient data manipulation and computation, consider using NumPy, as discussed in the `10_numpy` slides.\n", - "2. **Output Shape**: Ensure that the shape of your output data matches the number of patients, which is 60." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "82-bk4CBB1w4" - }, - "outputs": [], - "source": [ - "import numpy as np\n", - "\n", - "def patient_summary(file_path, operation):\n", - " # load the data from the file\n", - " data = np.loadtxt(fname=file_path, delimiter=',')\n", - " ax = 1 # this specifies that the operation should be done for each row (patient)\n", - "\n", - " # implement the specific operation based on the 'operation' argument\n", - " if operation == 'mean':\n", - " # YOUR CODE HERE: calculate the mean (average) number of flare-ups for each patient\n", - "\n", - " elif operation == 'max':\n", - " # YOUR CODE HERE: calculate the maximum number of flare-ups experienced by each patient\n", - "\n", - " elif operation == 'min':\n", - " # YOUR CODE HERE: calculate the minimum number of flare-ups experienced by each patient\n", - "\n", - " else:\n", - " # if the operation is not one of the expected values, raise an error\n", - " raise ValueError(\"Invalid operation. Please choose 'mean', 'max', or 'min'.\")\n", - "\n", - " return summary_values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "3TYo0-1SDLrd" - }, - "outputs": [], - "source": [ - "# test it out on the data file we read in and make sure the size is what we expect i.e., 60\n", - "# Your output for the first file should be 60\n", - "data_min = patient_summary(all_paths[0], 'min')\n", - "print(len(data_min))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "I-5m0RvxFx4J" - }, - "source": [ - "## 3. Error Detection in Patient Data\n", - "\n", - "Your final task is to develop a function named `detect_problems` that identifies any irregularities in the patient data, specifically focusing on detecting patients with a mean inflammation score of 0.\n", - "\n", - "**Function Specifications**:\n", - "- **Function Name**: `detect_problems`\n", - "- **Parameter**:\n", - " - `file_path`: A string that specifies the path to the CSV file containing patient data.\n", - "\n", - "**Expected Behavior**:\n", - "- The function should read the patient data from the file at `file_path`.\n", - "- Utilize the previously defined `patient_summary()` function to calculate the mean inflammation for each patient.\n", - "- Employ an additional helper function `check_zeros(x)` (provided) to determine if there are any zero values in the array of mean inflammations.\n", - "- The `detect_problems()` function should return `True` if there is at least one patient with a mean inflammation score of 0, and `False` otherwise.\n", - "\n", - "**Hints for Implementation**:\n", - "1. Call `patient_summary(file_path, 'mean')` to get the mean inflammation scores for all patients.\n", - "2. Use `check_zeros()` to evaluate the mean scores. This helper function takes an array as input and returns `True` if it finds zero values in the array.\n", - "3. Based on the output from `check_zeros()`, the `detect_problems()` function should return `True` (indicating an issue) if any mean inflammation scores of 0 are found, or `False` if none are found.\n", - "\n", - "**Note**: This function is crucial for identifying potential data entry errors, such as healthy individuals being mistakenly included in the dataset or other data-related issues." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "pb9EugDCJA4c" - }, - "source": [ - "**Understanding the `check_zeros(x)` Helper Function**\n", - "\n", - "The `check_zeros(x)` function is provided as a tool to assist with your data analysis. While you do not need to modify or fully understand the internal workings of this function, it's important to grasp its input, output, and what the output signifies:\n", - "\n", - "1. **Input**:\n", - " - **Parameter `x`**: This function takes an array of numbers as its input. In the context of your assignment, this array will typically represent a set of data points from your patient data, such as mean inflammation scores.\n", - "\n", - "2. **Output**:\n", - " - The function returns a boolean value: either `True` or `False`.\n", - "\n", - "3. **Interpreting the Output**:\n", - " - **Output is `True`**: This indicates that the array `x` contains at least one zero value. In the context of your analysis, this means that at least one patient has a mean inflammation score of 0, signaling a potential issue or anomaly in the data.\n", - " - **Output is `False`**: This signifies that there are no zero values in the array `x`. For your patient data, it means no patient has a mean inflammation score of 0, and thus no apparent anomalies of this type were detected.\n", - "\n", - "**Usage in Your Analysis**:\n", - "When using `check_zeros(x)` in conjunction with your `patient_summary()` function in the `detect_problems()` function, you'll be checking whether any patient in your dataset has an average (mean) inflammation score of 0." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "_svDiRkdIwiT" - }, - "outputs": [], - "source": [ - "# Run this cell so you can use this helper function\n", - "\n", - "def check_zeros(x):\n", - " '''\n", - " Given an array, x, check whether any values in x equal 0.\n", - " Return True if any values found, else returns False.\n", - " '''\n", - " # np.where() checks every value in x against the condition (x == 0) and returns a tuple of indices where it was True (i.e. x was 0)\n", - " flag = np.where(x == 0)[0]\n", - "\n", - " # Checks if there are any objects in flag (i.e. not empty)\n", - " # If not empty, it found at least one zero so flag is True, and vice-versa.\n", - " return len(flag) > 0" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "LEYPM5v4JT0i" - }, - "outputs": [], - "source": [ - "# Define your function `detect_problems` here\n", - "\n", - "def detect_problems(file_path):\n", - " #YOUR CODE HERE: use patient_summary() to get the means and check_zeros() to check for zeros in the means\n", - "\n", - " return" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Test out your code here\n", - "# Your output for the first file should be False\n", - "print(detect_problems(all_paths[0]))" - ] - }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "QmzeljDgm4Ll" + }, + "source": [ + "# Assignment #2: Efficacy Analysis of a Hypothetical Arthritis Drug\n", + "\n", + "**Objective**: In this assignment, your task is to utilize Python programming skills to evaluate the effectiveness of a fictional medication designed to reduce inflammation caused by arthritis flare-ups.\n", + "\n", + "**Background**: Imagine a clinical trial where 60 patients were administered a new drug for arthritis. Data from this trial has been recorded in a series of CSV files. Evaluate the effectiveness of a fictional medication designed to reduce inflammation caused by arthritis flare-ups.\n", + "\n", + "**Data Structure**:\n", + "- Each CSV file corresponds to a specific check-in session with the patients.\n", + "- There are 12 such CSV files, reflecting 12 different sessions where patients reported their experiences.\n", + "- Inside each file:\n", + " - Rows: Each of the 60 rows represents a unique patient.\n", + " - Columns: Each of the 40 columns corresponds to a day, detailing the number of inflammation flare-ups the patient experienced on that day.\n", + "\n", + "**Your Role**: Analyze this data to determine how effective the new drug has been in managing arthritis inflammation across the trial period." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Submission Information\n", + "\n", + "🚨 **Please review our [Assignment Submission Guide](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md)** 🚨 for detailed instructions on how to format, branch, and submit your work. Following these guidelines is crucial for your submissions to be evaluated correctly.\n", + "\n", + "### Submission Parameters:\n", + "* Submission Due Date: `11:59 PM - Dec 8, 2024`\n", + "* The branch name for your repo should be: `assignment-2`\n", + "* What to submit for this assignment:\n", + " * This Jupyter Notebook (assignment_2.ipynb) should be populated and should be the only change in your pull request.\n", + "* What the pull request link should look like for this assignment: `https://github.com//python/pull/`\n", + " * Open a private window in your browser. Copy and paste the link to your pull request into the address bar. Make sure you can see your pull request properly. This helps the technical facilitator and learning support staff review your submission easily.\n", + "\n", + "Checklist:\n", + "- [ ] Created a branch with the correct naming convention.\n", + "- [ ] Ensured that the repository is public.\n", + "- [ ] Reviewed the PR description guidelines and adhered to them.\n", + "- [ ] Verify that the link is accessible in a private browser window.\n", + "\n", + "If you encounter any difficulties or have questions, please don't hesitate to reach out to our team via our Slack at `#cohort-3-help`. Our Technical Facilitators and Learning Support staff are here to help you navigate any challenges." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yMsC2qsiKNP8" + }, + "source": [ + "**The file is located under `../05_src/data/assignment_2_data/`.**\n", + "\n", + "The filtered list has been made for you:\n", + "\n", + "```python\n", + "all_paths = [\n", + " \"../05_src/data/assignment_2_data/inflammation_01.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_02.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_03.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_04.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_05.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_06.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_07.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_08.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_09.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_10.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_11.csv\",\n", + " \"../05_src/data/assignment_2_data/inflammation_12.csv\"\n", + "]\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "all_paths = [\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", + "]\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JhJAJb1m-nkn" + }, + "source": [ + "## 1. Reading and Displaying Data from the First File\n", + "\n", + "With the list of the relevant `inflammation_xx.csv` file paths above, write a program to read the `inflammation_xx.csv` files, and display the contents of the first file in this list.\n", + "\n", + "**Hint**: Remember to use appropriate Python file handling and data reading methods. If you need guidance on how to handle CSV files in Python, refer to the relevant sections in your Python learning resources." + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "id": "n0m48JsS-nMC" + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "id": "j9SUzhiGuHhS" - }, - "source": [ - "| Criteria | Complete Criteria | Incomplete Criteria |\n", - "|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|\n", - "| **General Criteria** | | |\n", - "| Code Execution | All code cells execute without errors. | Any code cell produces an error upon execution. |\n", - "| Code Quality | Code is well-organized, concise, and includes necessary comments for clarity. | Code is unorganized, verbose, or lacks necessary comments. |\n", - "| Data Handling | Data files are correctly handled and processed. | Data files are not handled or processed correctly. |\n", - "| Adherence to Instructions | Follows all instructions and requirements as per the assignment. | Misses or incorrectly implements one or more of the assignment requirements. |\n", - "| **Specific Criteria** | | |\n", - "| 1. Reading in our files | Correctly prints out information from the first file. | Fails to print out information from the first file. |\n", - "| 2. Summarizing our data | Correctly defines `patient_summary()` function. Function processes data as per `operation` and outputs correctly shaped data (60 entries). | Incomplete or incorrect definition of `patient_summary()`. Incorrect implementation of operation or wrong output shape.|\n", - "| 3. Checking for Errors | Correctly defines `detect_problems()` function. Function uses `patient_summary()` and `check_zeros()` to identify mean inflammation of 0 accurately. | Incorrect definition or implementation of `detect_problems()` function. Fails to accurately identify mean inflammation of 0.|\n", - "| **Overall Assessment** | Meets all the general and specific criteria, indicating a strong understanding of the assignment objectives. | Fails to meet one or more of the general or specific criteria, indicating a need for further learning or clarification.|\n" - ] - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\n", + "\n", + "0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\n", + "\n", + "0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\n", + "\n", + "0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\n", + "\n", + "0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\n", + "\n", + "0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\n", + "\n", + "0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\n", + "\n", + "0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\n", + "\n", + "0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\n", + "\n", + "0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\n", + "\n", + "0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\n", + "\n", + "0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\n", + "\n", + "0,0,2,1,4,3,6,4,6,7,9,9,3,11,6,12,4,17,13,15,13,12,8,7,4,7,12,9,5,6,5,4,7,3,5,4,2,3,0,1\n", + "\n", + "0,0,0,0,1,3,1,6,6,5,5,6,3,6,13,3,10,13,9,16,15,9,11,4,6,4,11,11,12,3,5,8,7,4,6,4,1,3,0,0\n", + "\n", + "0,1,2,1,1,1,4,1,5,2,3,3,10,7,13,5,7,17,6,9,12,13,10,4,12,4,6,7,6,10,8,2,5,1,3,4,2,0,2,0\n", + "\n", + "0,1,1,0,1,2,4,3,6,4,7,5,5,7,5,10,7,8,18,17,9,8,12,11,11,11,14,6,11,2,10,9,5,6,5,3,4,2,2,0\n", + "\n", + "0,0,0,0,2,3,6,5,7,4,3,2,10,7,9,11,12,5,12,9,13,19,14,17,5,13,8,11,5,10,9,8,7,5,3,1,4,0,2,1\n", + "\n", + "0,0,0,1,2,1,4,3,6,7,4,2,12,6,12,4,14,7,8,14,13,19,6,9,12,6,4,13,6,7,2,3,6,5,4,2,3,0,1,0\n", + "\n", + "0,0,2,1,2,5,4,2,7,8,4,7,11,9,8,11,15,17,11,12,7,12,7,6,7,4,13,5,7,6,6,9,2,1,1,2,2,0,1,0\n", + "\n", + "0,1,2,0,1,4,3,2,2,7,3,3,12,13,11,13,6,5,9,16,9,19,16,11,8,9,14,12,11,9,6,6,6,1,1,2,4,3,1,1\n", + "\n", + "0,1,1,3,1,4,4,1,8,2,2,3,12,12,10,15,13,6,5,5,18,19,9,6,11,12,7,6,3,6,3,2,4,3,1,5,4,2,2,0\n", + "\n", + "0,0,2,3,2,3,2,6,3,8,7,4,6,6,9,5,12,12,8,5,12,10,16,7,14,12,5,4,6,9,8,5,6,6,1,4,3,0,2,0\n", + "\n", + "0,0,0,3,4,5,1,7,7,8,2,5,12,4,10,14,5,5,17,13,16,15,13,6,12,9,10,3,3,7,4,4,8,2,6,5,1,0,1,0\n", + "\n", + "0,1,1,1,1,3,3,2,6,3,9,7,8,8,4,13,7,14,11,15,14,13,5,13,7,14,9,10,5,11,5,3,5,1,1,4,4,1,2,0\n", + "\n", + "0,1,1,1,2,3,5,3,6,3,7,10,3,8,12,4,12,9,15,5,17,16,5,10,10,15,7,5,3,11,5,5,6,1,1,1,1,0,2,1\n", + "\n", + "0,0,2,1,3,3,2,7,4,4,3,8,12,9,12,9,5,16,8,17,7,11,14,7,13,11,7,12,12,7,8,5,7,2,2,4,1,1,1,0\n", + "\n", + "0,0,1,2,4,2,2,3,5,7,10,5,5,12,3,13,4,13,7,15,9,12,18,14,16,12,3,11,3,2,7,4,8,2,2,1,3,0,1,1\n", + "\n", + "0,0,1,1,1,5,1,5,2,2,4,10,4,8,14,6,15,6,12,15,15,13,7,17,4,5,11,4,8,7,9,4,5,3,2,5,4,3,2,1\n", + "\n", + "0,0,2,2,3,4,6,3,7,6,4,5,8,4,7,7,6,11,12,19,20,18,9,5,4,7,14,8,4,3,7,7,8,3,5,4,1,3,1,0\n", + "\n", + "0,0,0,1,4,4,6,3,8,6,4,10,12,3,3,6,8,7,17,16,14,15,17,4,14,13,4,4,12,11,6,9,5,5,2,5,2,1,0,1\n", + "\n", + "0,1,1,0,3,2,4,6,8,6,2,3,11,3,14,14,12,8,8,16,13,7,6,9,15,7,6,4,10,8,10,4,2,6,5,5,2,3,2,1\n", + "\n", + "0,0,2,3,3,4,5,3,6,7,10,5,10,13,14,3,8,10,9,9,19,15,15,6,8,8,11,5,5,7,3,6,6,4,5,2,2,3,0,0\n", + "\n", + "0,1,2,2,2,3,6,6,6,7,6,3,11,12,13,15,15,10,14,11,11,8,6,12,10,5,12,7,7,11,5,8,5,2,5,5,2,0,2,1\n", + "\n", + "0,0,2,1,3,5,6,7,5,8,9,3,12,10,12,4,12,9,13,10,10,6,10,11,4,15,13,7,3,4,2,9,7,2,4,2,1,2,1,1\n", + "\n", + "0,0,1,2,4,1,5,5,2,3,4,8,8,12,5,15,9,17,7,19,14,18,12,17,14,4,13,13,8,11,5,6,6,2,3,5,2,1,1,1\n", + "\n", + "0,0,0,3,1,3,6,4,3,4,8,3,4,8,3,11,5,7,10,5,15,9,16,17,16,3,8,9,8,3,3,9,5,1,6,5,4,2,2,0\n", + "\n", + "0,1,2,2,2,5,5,1,4,6,3,6,5,9,6,7,4,7,16,7,16,13,9,16,12,6,7,9,10,3,6,4,5,4,6,3,4,3,2,1\n", + "\n", + "0,1,1,2,3,1,5,1,2,2,5,7,6,6,5,10,6,7,17,13,15,16,17,14,4,4,10,10,10,11,9,9,5,4,4,2,1,0,1,0\n", + "\n", + "0,1,0,3,2,4,1,1,5,9,10,7,12,10,9,15,12,13,13,6,19,9,10,6,13,5,13,6,7,2,5,5,2,1,1,1,1,3,0,1\n", + "\n", + "0,1,1,3,1,1,5,5,3,7,2,2,3,12,4,6,8,15,16,16,15,4,14,5,13,10,7,10,6,3,2,3,6,3,3,5,4,3,2,1\n", + "\n", + "0,0,0,2,2,1,3,4,5,5,6,5,5,12,13,5,7,5,11,15,18,7,9,10,14,12,11,9,10,3,2,9,6,2,2,5,3,0,0,1\n", + "\n", + "0,0,1,3,3,1,2,1,8,9,2,8,10,3,8,6,10,13,11,17,19,6,4,11,6,12,7,5,5,4,4,8,2,6,6,4,2,2,0,0\n", + "\n", + "0,1,1,3,4,5,2,1,3,7,9,6,10,5,8,15,11,12,15,6,12,16,6,4,14,3,12,9,6,11,5,8,5,5,6,1,2,1,2,0\n", + "\n", + "0,0,1,3,1,4,3,6,7,8,5,7,11,3,6,11,6,10,6,19,18,14,6,10,7,9,8,5,8,3,10,2,5,1,5,4,2,1,0,1\n", + "\n", + "0,1,1,3,3,4,4,6,3,4,9,9,7,6,8,15,12,15,6,11,6,18,5,14,15,12,9,8,3,6,10,6,8,7,2,5,4,3,1,1\n", + "\n", + "0,1,2,2,4,3,1,4,8,9,5,10,10,3,4,6,7,11,16,6,14,9,11,10,10,7,10,8,8,4,5,8,4,4,5,2,4,1,1,0\n", + "\n", + "0,0,2,3,4,5,4,6,2,9,7,4,9,10,8,11,16,12,15,17,19,10,18,13,15,11,8,4,7,11,6,7,6,5,1,3,1,0,0,0\n", + "\n", + "0,1,1,3,1,4,6,2,8,2,10,3,11,9,13,15,5,15,6,10,10,5,14,15,12,7,4,5,11,4,6,9,5,6,1,1,2,1,2,1\n", + "\n", + "0,0,1,3,2,5,1,2,7,6,6,3,12,9,4,14,4,6,12,9,12,7,11,7,16,8,13,6,7,6,10,7,6,3,1,5,4,3,0,0\n", + "\n", + "0,0,1,2,3,4,5,7,5,4,10,5,12,12,5,4,7,9,18,16,16,10,15,15,10,4,3,7,5,9,4,6,2,4,1,4,2,2,2,1\n", + "\n", + "0,1,2,1,1,3,5,3,6,3,10,10,11,10,13,10,13,6,6,14,5,4,5,5,9,4,12,7,7,4,7,9,3,3,6,3,4,1,2,0\n", + "\n", + "0,1,2,2,3,5,2,4,5,6,8,3,5,4,3,15,15,12,16,7,20,15,12,8,9,6,12,5,8,3,8,5,4,1,3,2,1,3,1,0\n", + "\n", + "0,0,0,2,4,4,5,3,3,3,10,4,4,4,14,11,15,13,10,14,11,17,9,11,11,7,10,12,10,10,10,8,7,5,2,2,4,1,2,1\n", + "\n", + "0,0,2,1,1,4,4,7,2,9,4,10,12,7,6,6,11,12,9,15,15,6,6,13,5,12,9,6,4,7,7,6,5,4,1,4,2,2,2,1\n", + "\n", + "0,1,2,1,1,4,5,4,4,5,9,7,10,3,13,13,8,9,17,16,16,15,12,13,5,12,10,9,11,9,4,5,5,2,2,5,1,0,0,1\n", + "\n", + "0,0,1,3,2,3,6,4,5,7,2,4,11,11,3,8,8,16,5,13,16,5,8,8,6,9,10,10,9,3,3,5,3,5,4,5,3,3,0,1\n", + "\n", + "0,1,1,2,2,5,1,7,4,2,5,5,4,6,6,4,16,11,14,16,14,14,8,17,4,14,13,7,6,3,7,7,5,6,3,4,2,2,1,1\n", + "\n", + "0,1,1,1,4,1,6,4,6,3,6,5,6,4,14,13,13,9,12,19,9,10,15,10,9,10,10,7,5,6,8,6,6,4,3,5,2,1,1,1\n", + "\n", + "0,0,0,1,4,5,6,3,8,7,9,10,8,6,5,12,15,5,10,5,8,13,18,17,14,9,13,4,10,11,10,8,8,6,5,5,2,0,2,0\n", + "\n", + "0,0,1,0,3,2,5,4,8,2,9,3,3,10,12,9,14,11,13,8,6,18,11,9,13,11,8,5,5,2,8,5,3,5,4,1,3,1,1,0\n", + "\n" + ] + } + ], + "source": [ + "with open(all_paths[0], 'r') as f:\n", + " contents = f.readlines()\n", + "\n", + "for i in contents:\n", + " print(i)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "sacozX7oB1VP" + }, + "source": [ + "## 2. Data Summarization Function: `patient_summary`\n", + "\n", + "Your next step is to create a function named `patient_summary` that will compute summary statistics for each patient's data over a 40-day period.\n", + "\n", + "**Function Specifications**:\n", + "- **Function Name**: `patient_summary`\n", + "- **Parameters**:\n", + " 1. `file_path`: A string representing the path to the CSV file containing the patient data.\n", + " 2. `operation`: A string specifying the type of summary operation to perform. Acceptable values are \"mean\", \"max\", or \"min\". This will determine whether the function calculates the average, maximum, or minimum number of flare-ups for each patient over the 40 days.\n", + "\n", + "**Expected Behavior**:\n", + "- Your function should read the data from the file at `file_path`.\n", + "- Perform the specified `operation` (mean, max, or min) to summarize the flare-ups data for each of the 60 patients.\n", + "- Return an array with 60 elements, each element being the result of the summary operation for a corresponding patient.\n", + "\n", + "**Expected Output**:\n", + "- The output should be an array with a length of 60, aligning with the number of patients in the study.\n", + "\n", + "**Hints for Implementation**:\n", + "1. **Utilizing NumPy**: For efficient data manipulation and computation, consider using NumPy, as discussed in the `10_numpy` slides.\n", + "2. **Output Shape**: Ensure that the shape of your output data matches the number of patients, which is 60." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "82-bk4CBB1w4" + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "\n", + "def patient_summary(file_path, operation):\n", + " # load the data from the file\n", + " data = np.loadtxt(fname=file_path, delimiter=',')\n", + " ax = 1 # this specifies that the operation should be done for each row (patient)\n", + "\n", + " # implement the specific operation based on the 'operation' argument\n", + " if operation == 'mean':\n", + " summary_values = data.mean(ax)\n", + "\n", + " elif operation == 'max':\n", + " summary_values = data.max(ax)\n", + " \n", + " elif operation == 'min':\n", + " summary_values = data.min(ax)\n", + "\n", + " else:\n", + " # if the operation is not one of the expected values, raise an error\n", + " raise ValueError(\"Invalid operation. Please choose 'mean', 'max', or 'min'.\")\n", + "\n", + " return summary_values" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "id": "3TYo0-1SDLrd" + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "id": "TY_ppBzHvdak" - }, - "source": [ - "## References\n", - "\n", - "### Data Sources\n", - "- Software Carpentry. _Python Novice Inflammation Data_. http://swcarpentry.github.io/python-novice-inflammation/data/python-novice-inflammation-data.zip\n" - ] + "name": "stdout", + "output_type": "stream", + "text": [ + "60\n" + ] } - ], - "metadata": { - "colab": { - "provenance": [] - }, - "kernelspec": { - "display_name": "Python 3", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" + ], + "source": [ + "# test it out on the data file we read in and make sure the size is what we expect i.e., 60\n", + "# Your output for the first file should be 60\n", + "data_min = patient_summary(all_paths[0], 'min')\n", + "print(len(data_min))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "I-5m0RvxFx4J" + }, + "source": [ + "## 3. Error Detection in Patient Data\n", + "\n", + "Your final task is to develop a function named `detect_problems` that identifies any irregularities in the patient data, specifically focusing on detecting patients with a mean inflammation score of 0.\n", + "\n", + "**Function Specifications**:\n", + "- **Function Name**: `detect_problems`\n", + "- **Parameter**:\n", + " - `file_path`: A string that specifies the path to the CSV file containing patient data.\n", + "\n", + "**Expected Behavior**:\n", + "- The function should read the patient data from the file at `file_path`.\n", + "- Utilize the previously defined `patient_summary()` function to calculate the mean inflammation for each patient.\n", + "- Employ an additional helper function `check_zeros(x)` (provided) to determine if there are any zero values in the array of mean inflammations.\n", + "- The `detect_problems()` function should return `True` if there is at least one patient with a mean inflammation score of 0, and `False` otherwise.\n", + "\n", + "**Hints for Implementation**:\n", + "1. Call `patient_summary(file_path, 'mean')` to get the mean inflammation scores for all patients.\n", + "2. Use `check_zeros()` to evaluate the mean scores. This helper function takes an array as input and returns `True` if it finds zero values in the array.\n", + "3. Based on the output from `check_zeros()`, the `detect_problems()` function should return `True` (indicating an issue) if any mean inflammation scores of 0 are found, or `False` if none are found.\n", + "\n", + "**Note**: This function is crucial for identifying potential data entry errors, such as healthy individuals being mistakenly included in the dataset or other data-related issues." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "pb9EugDCJA4c" + }, + "source": [ + "**Understanding the `check_zeros(x)` Helper Function**\n", + "\n", + "The `check_zeros(x)` function is provided as a tool to assist with your data analysis. While you do not need to modify or fully understand the internal workings of this function, it's important to grasp its input, output, and what the output signifies:\n", + "\n", + "1. **Input**:\n", + " - **Parameter `x`**: This function takes an array of numbers as its input. In the context of your assignment, this array will typically represent a set of data points from your patient data, such as mean inflammation scores.\n", + "\n", + "2. **Output**:\n", + " - The function returns a boolean value: either `True` or `False`.\n", + "\n", + "3. **Interpreting the Output**:\n", + " - **Output is `True`**: This indicates that the array `x` contains at least one zero value. In the context of your analysis, this means that at least one patient has a mean inflammation score of 0, signaling a potential issue or anomaly in the data.\n", + " - **Output is `False`**: This signifies that there are no zero values in the array `x`. For your patient data, it means no patient has a mean inflammation score of 0, and thus no apparent anomalies of this type were detected.\n", + "\n", + "**Usage in Your Analysis**:\n", + "When using `check_zeros(x)` in conjunction with your `patient_summary()` function in the `detect_problems()` function, you'll be checking whether any patient in your dataset has an average (mean) inflammation score of 0." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "id": "_svDiRkdIwiT" + }, + "outputs": [], + "source": [ + "# Run this cell so you can use this helper function\n", + "\n", + "def check_zeros(x):\n", + " '''\n", + " Given an array, x, check whether any values in x equal 0.\n", + " Return True if any values found, else returns False.\n", + " '''\n", + " # np.where() checks every value in x against the condition (x == 0) and returns a tuple of indices where it was True (i.e. x was 0)\n", + " flag = np.where(x == 0)[0]\n", + "\n", + " # Checks if there are any objects in flag (i.e. not empty)\n", + " # If not empty, it found at least one zero so flag is True, and vice-versa.\n", + " return len(flag) > 0" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "id": "LEYPM5v4JT0i" + }, + "outputs": [], + "source": [ + "# Define your function `detect_problems` here\n", + "\n", + "def detect_problems(file_path):\n", + " mean_inflammation_score = patient_summary(file_path, 'mean')\n", + " \n", + " return check_zeros(mean_inflammation_score)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n" + ] } + ], + "source": [ + "# Test out your code here\n", + "# Your output for the first file should be False\n", + "print(detect_problems(all_paths[0]))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "j9SUzhiGuHhS" + }, + "source": [ + "| Criteria | Complete Criteria | Incomplete Criteria |\n", + "|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|\n", + "| **General Criteria** | | |\n", + "| Code Execution | All code cells execute without errors. | Any code cell produces an error upon execution. |\n", + "| Code Quality | Code is well-organized, concise, and includes necessary comments for clarity. | Code is unorganized, verbose, or lacks necessary comments. |\n", + "| Data Handling | Data files are correctly handled and processed. | Data files are not handled or processed correctly. |\n", + "| Adherence to Instructions | Follows all instructions and requirements as per the assignment. | Misses or incorrectly implements one or more of the assignment requirements. |\n", + "| **Specific Criteria** | | |\n", + "| 1. Reading in our files | Correctly prints out information from the first file. | Fails to print out information from the first file. |\n", + "| 2. Summarizing our data | Correctly defines `patient_summary()` function. Function processes data as per `operation` and outputs correctly shaped data (60 entries). | Incomplete or incorrect definition of `patient_summary()`. Incorrect implementation of operation or wrong output shape.|\n", + "| 3. Checking for Errors | Correctly defines `detect_problems()` function. Function uses `patient_summary()` and `check_zeros()` to identify mean inflammation of 0 accurately. | Incorrect definition or implementation of `detect_problems()` function. Fails to accurately identify mean inflammation of 0.|\n", + "| **Overall Assessment** | Meets all the general and specific criteria, indicating a strong understanding of the assignment objectives. | Fails to meet one or more of the general or specific criteria, indicating a need for further learning or clarification.|\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "TY_ppBzHvdak" + }, + "source": [ + "## References\n", + "\n", + "### Data Sources\n", + "- Software Carpentry. _Python Novice Inflammation Data_. http://swcarpentry.github.io/python-novice-inflammation/data/python-novice-inflammation-data.zip\n" + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "dsi_participant", + "language": "python", + "name": "python3" }, - "nbformat": 4, - "nbformat_minor": 0 + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.15" + } + }, + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/05_src/data/assignment_2_data/small_01.csv b/05_src/data/assignment_2_data/small_01.csv index 4d653271f..ab4765358 100644 --- a/05_src/data/assignment_2_data/small_01.csv +++ b/05_src/data/assignment_2_data/small_01.csv @@ -1,2 +1,2 @@ 0,0,1 -0,1,2 +0,0,0 diff --git a/provinces.txt b/provinces.txt new file mode 100644 index 000000000..794ada7c1 --- /dev/null +++ b/provinces.txt @@ -0,0 +1 @@ +BCABSKMBONQCNLNBNSPE \ No newline at end of file diff --git a/text.txt b/text.txt new file mode 100644 index 000000000..d283e463e --- /dev/null +++ b/text.txt @@ -0,0 +1 @@ +It is Dec 4th! \ No newline at end of file From 1ba81c9ca7ece049764d24def7ed85613359b07a Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 07:36:20 -0500 Subject: [PATCH 11/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 128 +------------------ 1 file changed, 6 insertions(+), 122 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 5d663c55d..da8d0798e 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -112,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 33, "metadata": { "id": "n0m48JsS-nMC" }, @@ -121,126 +121,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\n", - "\n", - "0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\n", - "\n", - "0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\n", - "\n", - "0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\n", - "\n", - "0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\n", - "\n", - "0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\n", - "\n", - "0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\n", - "\n", - "0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\n", - "\n", - "0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\n", - "\n", - "0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\n", - "\n", - "0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\n", - "\n", - "0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\n", - "\n", - "0,0,2,1,4,3,6,4,6,7,9,9,3,11,6,12,4,17,13,15,13,12,8,7,4,7,12,9,5,6,5,4,7,3,5,4,2,3,0,1\n", - "\n", - "0,0,0,0,1,3,1,6,6,5,5,6,3,6,13,3,10,13,9,16,15,9,11,4,6,4,11,11,12,3,5,8,7,4,6,4,1,3,0,0\n", - "\n", - "0,1,2,1,1,1,4,1,5,2,3,3,10,7,13,5,7,17,6,9,12,13,10,4,12,4,6,7,6,10,8,2,5,1,3,4,2,0,2,0\n", - "\n", - "0,1,1,0,1,2,4,3,6,4,7,5,5,7,5,10,7,8,18,17,9,8,12,11,11,11,14,6,11,2,10,9,5,6,5,3,4,2,2,0\n", - "\n", - "0,0,0,0,2,3,6,5,7,4,3,2,10,7,9,11,12,5,12,9,13,19,14,17,5,13,8,11,5,10,9,8,7,5,3,1,4,0,2,1\n", - "\n", - "0,0,0,1,2,1,4,3,6,7,4,2,12,6,12,4,14,7,8,14,13,19,6,9,12,6,4,13,6,7,2,3,6,5,4,2,3,0,1,0\n", - "\n", - "0,0,2,1,2,5,4,2,7,8,4,7,11,9,8,11,15,17,11,12,7,12,7,6,7,4,13,5,7,6,6,9,2,1,1,2,2,0,1,0\n", - "\n", - "0,1,2,0,1,4,3,2,2,7,3,3,12,13,11,13,6,5,9,16,9,19,16,11,8,9,14,12,11,9,6,6,6,1,1,2,4,3,1,1\n", - "\n", - "0,1,1,3,1,4,4,1,8,2,2,3,12,12,10,15,13,6,5,5,18,19,9,6,11,12,7,6,3,6,3,2,4,3,1,5,4,2,2,0\n", - "\n", - "0,0,2,3,2,3,2,6,3,8,7,4,6,6,9,5,12,12,8,5,12,10,16,7,14,12,5,4,6,9,8,5,6,6,1,4,3,0,2,0\n", - "\n", - "0,0,0,3,4,5,1,7,7,8,2,5,12,4,10,14,5,5,17,13,16,15,13,6,12,9,10,3,3,7,4,4,8,2,6,5,1,0,1,0\n", - "\n", - "0,1,1,1,1,3,3,2,6,3,9,7,8,8,4,13,7,14,11,15,14,13,5,13,7,14,9,10,5,11,5,3,5,1,1,4,4,1,2,0\n", - "\n", - "0,1,1,1,2,3,5,3,6,3,7,10,3,8,12,4,12,9,15,5,17,16,5,10,10,15,7,5,3,11,5,5,6,1,1,1,1,0,2,1\n", - "\n", - "0,0,2,1,3,3,2,7,4,4,3,8,12,9,12,9,5,16,8,17,7,11,14,7,13,11,7,12,12,7,8,5,7,2,2,4,1,1,1,0\n", - "\n", - "0,0,1,2,4,2,2,3,5,7,10,5,5,12,3,13,4,13,7,15,9,12,18,14,16,12,3,11,3,2,7,4,8,2,2,1,3,0,1,1\n", - "\n", - "0,0,1,1,1,5,1,5,2,2,4,10,4,8,14,6,15,6,12,15,15,13,7,17,4,5,11,4,8,7,9,4,5,3,2,5,4,3,2,1\n", - "\n", - "0,0,2,2,3,4,6,3,7,6,4,5,8,4,7,7,6,11,12,19,20,18,9,5,4,7,14,8,4,3,7,7,8,3,5,4,1,3,1,0\n", - "\n", - "0,0,0,1,4,4,6,3,8,6,4,10,12,3,3,6,8,7,17,16,14,15,17,4,14,13,4,4,12,11,6,9,5,5,2,5,2,1,0,1\n", - "\n", - "0,1,1,0,3,2,4,6,8,6,2,3,11,3,14,14,12,8,8,16,13,7,6,9,15,7,6,4,10,8,10,4,2,6,5,5,2,3,2,1\n", - "\n", - "0,0,2,3,3,4,5,3,6,7,10,5,10,13,14,3,8,10,9,9,19,15,15,6,8,8,11,5,5,7,3,6,6,4,5,2,2,3,0,0\n", - "\n", - "0,1,2,2,2,3,6,6,6,7,6,3,11,12,13,15,15,10,14,11,11,8,6,12,10,5,12,7,7,11,5,8,5,2,5,5,2,0,2,1\n", - "\n", - "0,0,2,1,3,5,6,7,5,8,9,3,12,10,12,4,12,9,13,10,10,6,10,11,4,15,13,7,3,4,2,9,7,2,4,2,1,2,1,1\n", - "\n", - "0,0,1,2,4,1,5,5,2,3,4,8,8,12,5,15,9,17,7,19,14,18,12,17,14,4,13,13,8,11,5,6,6,2,3,5,2,1,1,1\n", - "\n", - "0,0,0,3,1,3,6,4,3,4,8,3,4,8,3,11,5,7,10,5,15,9,16,17,16,3,8,9,8,3,3,9,5,1,6,5,4,2,2,0\n", - "\n", - "0,1,2,2,2,5,5,1,4,6,3,6,5,9,6,7,4,7,16,7,16,13,9,16,12,6,7,9,10,3,6,4,5,4,6,3,4,3,2,1\n", - "\n", - "0,1,1,2,3,1,5,1,2,2,5,7,6,6,5,10,6,7,17,13,15,16,17,14,4,4,10,10,10,11,9,9,5,4,4,2,1,0,1,0\n", - "\n", - "0,1,0,3,2,4,1,1,5,9,10,7,12,10,9,15,12,13,13,6,19,9,10,6,13,5,13,6,7,2,5,5,2,1,1,1,1,3,0,1\n", - "\n", - "0,1,1,3,1,1,5,5,3,7,2,2,3,12,4,6,8,15,16,16,15,4,14,5,13,10,7,10,6,3,2,3,6,3,3,5,4,3,2,1\n", - "\n", - "0,0,0,2,2,1,3,4,5,5,6,5,5,12,13,5,7,5,11,15,18,7,9,10,14,12,11,9,10,3,2,9,6,2,2,5,3,0,0,1\n", - "\n", - "0,0,1,3,3,1,2,1,8,9,2,8,10,3,8,6,10,13,11,17,19,6,4,11,6,12,7,5,5,4,4,8,2,6,6,4,2,2,0,0\n", - "\n", - "0,1,1,3,4,5,2,1,3,7,9,6,10,5,8,15,11,12,15,6,12,16,6,4,14,3,12,9,6,11,5,8,5,5,6,1,2,1,2,0\n", - "\n", - "0,0,1,3,1,4,3,6,7,8,5,7,11,3,6,11,6,10,6,19,18,14,6,10,7,9,8,5,8,3,10,2,5,1,5,4,2,1,0,1\n", - "\n", - "0,1,1,3,3,4,4,6,3,4,9,9,7,6,8,15,12,15,6,11,6,18,5,14,15,12,9,8,3,6,10,6,8,7,2,5,4,3,1,1\n", - "\n", - "0,1,2,2,4,3,1,4,8,9,5,10,10,3,4,6,7,11,16,6,14,9,11,10,10,7,10,8,8,4,5,8,4,4,5,2,4,1,1,0\n", - "\n", - "0,0,2,3,4,5,4,6,2,9,7,4,9,10,8,11,16,12,15,17,19,10,18,13,15,11,8,4,7,11,6,7,6,5,1,3,1,0,0,0\n", - "\n", - "0,1,1,3,1,4,6,2,8,2,10,3,11,9,13,15,5,15,6,10,10,5,14,15,12,7,4,5,11,4,6,9,5,6,1,1,2,1,2,1\n", - "\n", - "0,0,1,3,2,5,1,2,7,6,6,3,12,9,4,14,4,6,12,9,12,7,11,7,16,8,13,6,7,6,10,7,6,3,1,5,4,3,0,0\n", - "\n", - "0,0,1,2,3,4,5,7,5,4,10,5,12,12,5,4,7,9,18,16,16,10,15,15,10,4,3,7,5,9,4,6,2,4,1,4,2,2,2,1\n", - "\n", - "0,1,2,1,1,3,5,3,6,3,10,10,11,10,13,10,13,6,6,14,5,4,5,5,9,4,12,7,7,4,7,9,3,3,6,3,4,1,2,0\n", - "\n", - "0,1,2,2,3,5,2,4,5,6,8,3,5,4,3,15,15,12,16,7,20,15,12,8,9,6,12,5,8,3,8,5,4,1,3,2,1,3,1,0\n", - "\n", - "0,0,0,2,4,4,5,3,3,3,10,4,4,4,14,11,15,13,10,14,11,17,9,11,11,7,10,12,10,10,10,8,7,5,2,2,4,1,2,1\n", - "\n", - "0,0,2,1,1,4,4,7,2,9,4,10,12,7,6,6,11,12,9,15,15,6,6,13,5,12,9,6,4,7,7,6,5,4,1,4,2,2,2,1\n", - "\n", - "0,1,2,1,1,4,5,4,4,5,9,7,10,3,13,13,8,9,17,16,16,15,12,13,5,12,10,9,11,9,4,5,5,2,2,5,1,0,0,1\n", - "\n", - "0,0,1,3,2,3,6,4,5,7,2,4,11,11,3,8,8,16,5,13,16,5,8,8,6,9,10,10,9,3,3,5,3,5,4,5,3,3,0,1\n", - "\n", - "0,1,1,2,2,5,1,7,4,2,5,5,4,6,6,4,16,11,14,16,14,14,8,17,4,14,13,7,6,3,7,7,5,6,3,4,2,2,1,1\n", - "\n", - "0,1,1,1,4,1,6,4,6,3,6,5,6,4,14,13,13,9,12,19,9,10,15,10,9,10,10,7,5,6,8,6,6,4,3,5,2,1,1,1\n", - "\n", - "0,0,0,1,4,5,6,3,8,7,9,10,8,6,5,12,15,5,10,5,8,13,18,17,14,9,13,4,10,11,10,8,8,6,5,5,2,0,2,0\n", - "\n", - "0,0,1,0,3,2,5,4,8,2,9,3,3,10,12,9,14,11,13,8,6,18,11,9,13,11,8,5,5,2,8,5,3,5,4,1,3,1,1,0\n", - "\n" + "['0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\\n', '0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\\n', '0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\\n', '0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\\n', '0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\\n', '0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\\n', '0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\\n', '0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\\n', '0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\\n', '0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\\n', '0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\\n', '0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\\n', '0,0,2,1,4,3,6,4,6,7,9,9,3,11,6,12,4,17,13,15,13,12,8,7,4,7,12,9,5,6,5,4,7,3,5,4,2,3,0,1\\n', '0,0,0,0,1,3,1,6,6,5,5,6,3,6,13,3,10,13,9,16,15,9,11,4,6,4,11,11,12,3,5,8,7,4,6,4,1,3,0,0\\n', '0,1,2,1,1,1,4,1,5,2,3,3,10,7,13,5,7,17,6,9,12,13,10,4,12,4,6,7,6,10,8,2,5,1,3,4,2,0,2,0\\n', '0,1,1,0,1,2,4,3,6,4,7,5,5,7,5,10,7,8,18,17,9,8,12,11,11,11,14,6,11,2,10,9,5,6,5,3,4,2,2,0\\n', '0,0,0,0,2,3,6,5,7,4,3,2,10,7,9,11,12,5,12,9,13,19,14,17,5,13,8,11,5,10,9,8,7,5,3,1,4,0,2,1\\n', '0,0,0,1,2,1,4,3,6,7,4,2,12,6,12,4,14,7,8,14,13,19,6,9,12,6,4,13,6,7,2,3,6,5,4,2,3,0,1,0\\n', '0,0,2,1,2,5,4,2,7,8,4,7,11,9,8,11,15,17,11,12,7,12,7,6,7,4,13,5,7,6,6,9,2,1,1,2,2,0,1,0\\n', '0,1,2,0,1,4,3,2,2,7,3,3,12,13,11,13,6,5,9,16,9,19,16,11,8,9,14,12,11,9,6,6,6,1,1,2,4,3,1,1\\n', '0,1,1,3,1,4,4,1,8,2,2,3,12,12,10,15,13,6,5,5,18,19,9,6,11,12,7,6,3,6,3,2,4,3,1,5,4,2,2,0\\n', '0,0,2,3,2,3,2,6,3,8,7,4,6,6,9,5,12,12,8,5,12,10,16,7,14,12,5,4,6,9,8,5,6,6,1,4,3,0,2,0\\n', '0,0,0,3,4,5,1,7,7,8,2,5,12,4,10,14,5,5,17,13,16,15,13,6,12,9,10,3,3,7,4,4,8,2,6,5,1,0,1,0\\n', '0,1,1,1,1,3,3,2,6,3,9,7,8,8,4,13,7,14,11,15,14,13,5,13,7,14,9,10,5,11,5,3,5,1,1,4,4,1,2,0\\n', '0,1,1,1,2,3,5,3,6,3,7,10,3,8,12,4,12,9,15,5,17,16,5,10,10,15,7,5,3,11,5,5,6,1,1,1,1,0,2,1\\n', '0,0,2,1,3,3,2,7,4,4,3,8,12,9,12,9,5,16,8,17,7,11,14,7,13,11,7,12,12,7,8,5,7,2,2,4,1,1,1,0\\n', '0,0,1,2,4,2,2,3,5,7,10,5,5,12,3,13,4,13,7,15,9,12,18,14,16,12,3,11,3,2,7,4,8,2,2,1,3,0,1,1\\n', '0,0,1,1,1,5,1,5,2,2,4,10,4,8,14,6,15,6,12,15,15,13,7,17,4,5,11,4,8,7,9,4,5,3,2,5,4,3,2,1\\n', '0,0,2,2,3,4,6,3,7,6,4,5,8,4,7,7,6,11,12,19,20,18,9,5,4,7,14,8,4,3,7,7,8,3,5,4,1,3,1,0\\n', '0,0,0,1,4,4,6,3,8,6,4,10,12,3,3,6,8,7,17,16,14,15,17,4,14,13,4,4,12,11,6,9,5,5,2,5,2,1,0,1\\n', '0,1,1,0,3,2,4,6,8,6,2,3,11,3,14,14,12,8,8,16,13,7,6,9,15,7,6,4,10,8,10,4,2,6,5,5,2,3,2,1\\n', '0,0,2,3,3,4,5,3,6,7,10,5,10,13,14,3,8,10,9,9,19,15,15,6,8,8,11,5,5,7,3,6,6,4,5,2,2,3,0,0\\n', '0,1,2,2,2,3,6,6,6,7,6,3,11,12,13,15,15,10,14,11,11,8,6,12,10,5,12,7,7,11,5,8,5,2,5,5,2,0,2,1\\n', '0,0,2,1,3,5,6,7,5,8,9,3,12,10,12,4,12,9,13,10,10,6,10,11,4,15,13,7,3,4,2,9,7,2,4,2,1,2,1,1\\n', '0,0,1,2,4,1,5,5,2,3,4,8,8,12,5,15,9,17,7,19,14,18,12,17,14,4,13,13,8,11,5,6,6,2,3,5,2,1,1,1\\n', '0,0,0,3,1,3,6,4,3,4,8,3,4,8,3,11,5,7,10,5,15,9,16,17,16,3,8,9,8,3,3,9,5,1,6,5,4,2,2,0\\n', '0,1,2,2,2,5,5,1,4,6,3,6,5,9,6,7,4,7,16,7,16,13,9,16,12,6,7,9,10,3,6,4,5,4,6,3,4,3,2,1\\n', '0,1,1,2,3,1,5,1,2,2,5,7,6,6,5,10,6,7,17,13,15,16,17,14,4,4,10,10,10,11,9,9,5,4,4,2,1,0,1,0\\n', '0,1,0,3,2,4,1,1,5,9,10,7,12,10,9,15,12,13,13,6,19,9,10,6,13,5,13,6,7,2,5,5,2,1,1,1,1,3,0,1\\n', '0,1,1,3,1,1,5,5,3,7,2,2,3,12,4,6,8,15,16,16,15,4,14,5,13,10,7,10,6,3,2,3,6,3,3,5,4,3,2,1\\n', '0,0,0,2,2,1,3,4,5,5,6,5,5,12,13,5,7,5,11,15,18,7,9,10,14,12,11,9,10,3,2,9,6,2,2,5,3,0,0,1\\n', '0,0,1,3,3,1,2,1,8,9,2,8,10,3,8,6,10,13,11,17,19,6,4,11,6,12,7,5,5,4,4,8,2,6,6,4,2,2,0,0\\n', '0,1,1,3,4,5,2,1,3,7,9,6,10,5,8,15,11,12,15,6,12,16,6,4,14,3,12,9,6,11,5,8,5,5,6,1,2,1,2,0\\n', '0,0,1,3,1,4,3,6,7,8,5,7,11,3,6,11,6,10,6,19,18,14,6,10,7,9,8,5,8,3,10,2,5,1,5,4,2,1,0,1\\n', '0,1,1,3,3,4,4,6,3,4,9,9,7,6,8,15,12,15,6,11,6,18,5,14,15,12,9,8,3,6,10,6,8,7,2,5,4,3,1,1\\n', '0,1,2,2,4,3,1,4,8,9,5,10,10,3,4,6,7,11,16,6,14,9,11,10,10,7,10,8,8,4,5,8,4,4,5,2,4,1,1,0\\n', '0,0,2,3,4,5,4,6,2,9,7,4,9,10,8,11,16,12,15,17,19,10,18,13,15,11,8,4,7,11,6,7,6,5,1,3,1,0,0,0\\n', '0,1,1,3,1,4,6,2,8,2,10,3,11,9,13,15,5,15,6,10,10,5,14,15,12,7,4,5,11,4,6,9,5,6,1,1,2,1,2,1\\n', '0,0,1,3,2,5,1,2,7,6,6,3,12,9,4,14,4,6,12,9,12,7,11,7,16,8,13,6,7,6,10,7,6,3,1,5,4,3,0,0\\n', '0,0,1,2,3,4,5,7,5,4,10,5,12,12,5,4,7,9,18,16,16,10,15,15,10,4,3,7,5,9,4,6,2,4,1,4,2,2,2,1\\n', '0,1,2,1,1,3,5,3,6,3,10,10,11,10,13,10,13,6,6,14,5,4,5,5,9,4,12,7,7,4,7,9,3,3,6,3,4,1,2,0\\n', '0,1,2,2,3,5,2,4,5,6,8,3,5,4,3,15,15,12,16,7,20,15,12,8,9,6,12,5,8,3,8,5,4,1,3,2,1,3,1,0\\n', '0,0,0,2,4,4,5,3,3,3,10,4,4,4,14,11,15,13,10,14,11,17,9,11,11,7,10,12,10,10,10,8,7,5,2,2,4,1,2,1\\n', '0,0,2,1,1,4,4,7,2,9,4,10,12,7,6,6,11,12,9,15,15,6,6,13,5,12,9,6,4,7,7,6,5,4,1,4,2,2,2,1\\n', '0,1,2,1,1,4,5,4,4,5,9,7,10,3,13,13,8,9,17,16,16,15,12,13,5,12,10,9,11,9,4,5,5,2,2,5,1,0,0,1\\n', '0,0,1,3,2,3,6,4,5,7,2,4,11,11,3,8,8,16,5,13,16,5,8,8,6,9,10,10,9,3,3,5,3,5,4,5,3,3,0,1\\n', '0,1,1,2,2,5,1,7,4,2,5,5,4,6,6,4,16,11,14,16,14,14,8,17,4,14,13,7,6,3,7,7,5,6,3,4,2,2,1,1\\n', '0,1,1,1,4,1,6,4,6,3,6,5,6,4,14,13,13,9,12,19,9,10,15,10,9,10,10,7,5,6,8,6,6,4,3,5,2,1,1,1\\n', '0,0,0,1,4,5,6,3,8,7,9,10,8,6,5,12,15,5,10,5,8,13,18,17,14,9,13,4,10,11,10,8,8,6,5,5,2,0,2,0\\n', '0,0,1,0,3,2,5,4,8,2,9,3,3,10,12,9,14,11,13,8,6,18,11,9,13,11,8,5,5,2,8,5,3,5,4,1,3,1,1,0\\n']\n" ] } ], @@ -248,8 +129,11 @@ "with open(all_paths[0], 'r') as f:\n", " contents = f.readlines()\n", "\n", + "data_list = []\n", "for i in contents:\n", - " print(i)" + " data_list.append(i)\n", + "\n", + "print(data_list)" ] }, { From c0f116d30748b0c31c8be0c7da5d84c9fa3eb860 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 07:40:31 -0500 Subject: [PATCH 12/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 128 ++++++++++++++++++- 1 file changed, 122 insertions(+), 6 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index da8d0798e..7bc037382 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -112,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 34, "metadata": { "id": "n0m48JsS-nMC" }, @@ -121,7 +121,126 @@ "name": "stdout", "output_type": "stream", "text": [ - "['0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\\n', '0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\\n', '0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\\n', '0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\\n', '0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\\n', '0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\\n', '0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\\n', '0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\\n', '0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\\n', '0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\\n', '0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\\n', '0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\\n', '0,0,2,1,4,3,6,4,6,7,9,9,3,11,6,12,4,17,13,15,13,12,8,7,4,7,12,9,5,6,5,4,7,3,5,4,2,3,0,1\\n', '0,0,0,0,1,3,1,6,6,5,5,6,3,6,13,3,10,13,9,16,15,9,11,4,6,4,11,11,12,3,5,8,7,4,6,4,1,3,0,0\\n', '0,1,2,1,1,1,4,1,5,2,3,3,10,7,13,5,7,17,6,9,12,13,10,4,12,4,6,7,6,10,8,2,5,1,3,4,2,0,2,0\\n', '0,1,1,0,1,2,4,3,6,4,7,5,5,7,5,10,7,8,18,17,9,8,12,11,11,11,14,6,11,2,10,9,5,6,5,3,4,2,2,0\\n', '0,0,0,0,2,3,6,5,7,4,3,2,10,7,9,11,12,5,12,9,13,19,14,17,5,13,8,11,5,10,9,8,7,5,3,1,4,0,2,1\\n', '0,0,0,1,2,1,4,3,6,7,4,2,12,6,12,4,14,7,8,14,13,19,6,9,12,6,4,13,6,7,2,3,6,5,4,2,3,0,1,0\\n', '0,0,2,1,2,5,4,2,7,8,4,7,11,9,8,11,15,17,11,12,7,12,7,6,7,4,13,5,7,6,6,9,2,1,1,2,2,0,1,0\\n', '0,1,2,0,1,4,3,2,2,7,3,3,12,13,11,13,6,5,9,16,9,19,16,11,8,9,14,12,11,9,6,6,6,1,1,2,4,3,1,1\\n', '0,1,1,3,1,4,4,1,8,2,2,3,12,12,10,15,13,6,5,5,18,19,9,6,11,12,7,6,3,6,3,2,4,3,1,5,4,2,2,0\\n', '0,0,2,3,2,3,2,6,3,8,7,4,6,6,9,5,12,12,8,5,12,10,16,7,14,12,5,4,6,9,8,5,6,6,1,4,3,0,2,0\\n', '0,0,0,3,4,5,1,7,7,8,2,5,12,4,10,14,5,5,17,13,16,15,13,6,12,9,10,3,3,7,4,4,8,2,6,5,1,0,1,0\\n', '0,1,1,1,1,3,3,2,6,3,9,7,8,8,4,13,7,14,11,15,14,13,5,13,7,14,9,10,5,11,5,3,5,1,1,4,4,1,2,0\\n', '0,1,1,1,2,3,5,3,6,3,7,10,3,8,12,4,12,9,15,5,17,16,5,10,10,15,7,5,3,11,5,5,6,1,1,1,1,0,2,1\\n', '0,0,2,1,3,3,2,7,4,4,3,8,12,9,12,9,5,16,8,17,7,11,14,7,13,11,7,12,12,7,8,5,7,2,2,4,1,1,1,0\\n', '0,0,1,2,4,2,2,3,5,7,10,5,5,12,3,13,4,13,7,15,9,12,18,14,16,12,3,11,3,2,7,4,8,2,2,1,3,0,1,1\\n', '0,0,1,1,1,5,1,5,2,2,4,10,4,8,14,6,15,6,12,15,15,13,7,17,4,5,11,4,8,7,9,4,5,3,2,5,4,3,2,1\\n', '0,0,2,2,3,4,6,3,7,6,4,5,8,4,7,7,6,11,12,19,20,18,9,5,4,7,14,8,4,3,7,7,8,3,5,4,1,3,1,0\\n', '0,0,0,1,4,4,6,3,8,6,4,10,12,3,3,6,8,7,17,16,14,15,17,4,14,13,4,4,12,11,6,9,5,5,2,5,2,1,0,1\\n', '0,1,1,0,3,2,4,6,8,6,2,3,11,3,14,14,12,8,8,16,13,7,6,9,15,7,6,4,10,8,10,4,2,6,5,5,2,3,2,1\\n', '0,0,2,3,3,4,5,3,6,7,10,5,10,13,14,3,8,10,9,9,19,15,15,6,8,8,11,5,5,7,3,6,6,4,5,2,2,3,0,0\\n', '0,1,2,2,2,3,6,6,6,7,6,3,11,12,13,15,15,10,14,11,11,8,6,12,10,5,12,7,7,11,5,8,5,2,5,5,2,0,2,1\\n', '0,0,2,1,3,5,6,7,5,8,9,3,12,10,12,4,12,9,13,10,10,6,10,11,4,15,13,7,3,4,2,9,7,2,4,2,1,2,1,1\\n', '0,0,1,2,4,1,5,5,2,3,4,8,8,12,5,15,9,17,7,19,14,18,12,17,14,4,13,13,8,11,5,6,6,2,3,5,2,1,1,1\\n', '0,0,0,3,1,3,6,4,3,4,8,3,4,8,3,11,5,7,10,5,15,9,16,17,16,3,8,9,8,3,3,9,5,1,6,5,4,2,2,0\\n', '0,1,2,2,2,5,5,1,4,6,3,6,5,9,6,7,4,7,16,7,16,13,9,16,12,6,7,9,10,3,6,4,5,4,6,3,4,3,2,1\\n', '0,1,1,2,3,1,5,1,2,2,5,7,6,6,5,10,6,7,17,13,15,16,17,14,4,4,10,10,10,11,9,9,5,4,4,2,1,0,1,0\\n', '0,1,0,3,2,4,1,1,5,9,10,7,12,10,9,15,12,13,13,6,19,9,10,6,13,5,13,6,7,2,5,5,2,1,1,1,1,3,0,1\\n', '0,1,1,3,1,1,5,5,3,7,2,2,3,12,4,6,8,15,16,16,15,4,14,5,13,10,7,10,6,3,2,3,6,3,3,5,4,3,2,1\\n', '0,0,0,2,2,1,3,4,5,5,6,5,5,12,13,5,7,5,11,15,18,7,9,10,14,12,11,9,10,3,2,9,6,2,2,5,3,0,0,1\\n', '0,0,1,3,3,1,2,1,8,9,2,8,10,3,8,6,10,13,11,17,19,6,4,11,6,12,7,5,5,4,4,8,2,6,6,4,2,2,0,0\\n', '0,1,1,3,4,5,2,1,3,7,9,6,10,5,8,15,11,12,15,6,12,16,6,4,14,3,12,9,6,11,5,8,5,5,6,1,2,1,2,0\\n', '0,0,1,3,1,4,3,6,7,8,5,7,11,3,6,11,6,10,6,19,18,14,6,10,7,9,8,5,8,3,10,2,5,1,5,4,2,1,0,1\\n', '0,1,1,3,3,4,4,6,3,4,9,9,7,6,8,15,12,15,6,11,6,18,5,14,15,12,9,8,3,6,10,6,8,7,2,5,4,3,1,1\\n', '0,1,2,2,4,3,1,4,8,9,5,10,10,3,4,6,7,11,16,6,14,9,11,10,10,7,10,8,8,4,5,8,4,4,5,2,4,1,1,0\\n', '0,0,2,3,4,5,4,6,2,9,7,4,9,10,8,11,16,12,15,17,19,10,18,13,15,11,8,4,7,11,6,7,6,5,1,3,1,0,0,0\\n', '0,1,1,3,1,4,6,2,8,2,10,3,11,9,13,15,5,15,6,10,10,5,14,15,12,7,4,5,11,4,6,9,5,6,1,1,2,1,2,1\\n', '0,0,1,3,2,5,1,2,7,6,6,3,12,9,4,14,4,6,12,9,12,7,11,7,16,8,13,6,7,6,10,7,6,3,1,5,4,3,0,0\\n', '0,0,1,2,3,4,5,7,5,4,10,5,12,12,5,4,7,9,18,16,16,10,15,15,10,4,3,7,5,9,4,6,2,4,1,4,2,2,2,1\\n', '0,1,2,1,1,3,5,3,6,3,10,10,11,10,13,10,13,6,6,14,5,4,5,5,9,4,12,7,7,4,7,9,3,3,6,3,4,1,2,0\\n', '0,1,2,2,3,5,2,4,5,6,8,3,5,4,3,15,15,12,16,7,20,15,12,8,9,6,12,5,8,3,8,5,4,1,3,2,1,3,1,0\\n', '0,0,0,2,4,4,5,3,3,3,10,4,4,4,14,11,15,13,10,14,11,17,9,11,11,7,10,12,10,10,10,8,7,5,2,2,4,1,2,1\\n', '0,0,2,1,1,4,4,7,2,9,4,10,12,7,6,6,11,12,9,15,15,6,6,13,5,12,9,6,4,7,7,6,5,4,1,4,2,2,2,1\\n', '0,1,2,1,1,4,5,4,4,5,9,7,10,3,13,13,8,9,17,16,16,15,12,13,5,12,10,9,11,9,4,5,5,2,2,5,1,0,0,1\\n', '0,0,1,3,2,3,6,4,5,7,2,4,11,11,3,8,8,16,5,13,16,5,8,8,6,9,10,10,9,3,3,5,3,5,4,5,3,3,0,1\\n', '0,1,1,2,2,5,1,7,4,2,5,5,4,6,6,4,16,11,14,16,14,14,8,17,4,14,13,7,6,3,7,7,5,6,3,4,2,2,1,1\\n', '0,1,1,1,4,1,6,4,6,3,6,5,6,4,14,13,13,9,12,19,9,10,15,10,9,10,10,7,5,6,8,6,6,4,3,5,2,1,1,1\\n', '0,0,0,1,4,5,6,3,8,7,9,10,8,6,5,12,15,5,10,5,8,13,18,17,14,9,13,4,10,11,10,8,8,6,5,5,2,0,2,0\\n', '0,0,1,0,3,2,5,4,8,2,9,3,3,10,12,9,14,11,13,8,6,18,11,9,13,11,8,5,5,2,8,5,3,5,4,1,3,1,1,0\\n']\n" + "0,0,1,3,1,2,4,7,8,3,3,3,10,5,7,4,7,7,12,18,6,13,11,11,7,7,4,6,8,8,4,4,5,7,3,4,2,3,0,0\n", + "\n", + "0,1,2,1,2,1,3,2,2,6,10,11,5,9,4,4,7,16,8,6,18,4,12,5,12,7,11,5,11,3,3,5,4,4,5,5,1,1,0,1\n", + "\n", + "0,1,1,3,3,2,6,2,5,9,5,7,4,5,4,15,5,11,9,10,19,14,12,17,7,12,11,7,4,2,10,5,4,2,2,3,2,2,1,1\n", + "\n", + "0,0,2,0,4,2,2,1,6,7,10,7,9,13,8,8,15,10,10,7,17,4,4,7,6,15,6,4,9,11,3,5,6,3,3,4,2,3,2,1\n", + "\n", + "0,1,1,3,3,1,3,5,2,4,4,7,6,5,3,10,8,10,6,17,9,14,9,7,13,9,12,6,7,7,9,6,3,2,2,4,2,0,1,1\n", + "\n", + "0,0,1,2,2,4,2,1,6,4,7,6,6,9,9,15,4,16,18,12,12,5,18,9,5,3,10,3,12,7,8,4,7,3,5,4,4,3,2,1\n", + "\n", + "0,0,2,2,4,2,2,5,5,8,6,5,11,9,4,13,5,12,10,6,9,17,15,8,9,3,13,7,8,2,8,8,4,2,3,5,4,1,1,1\n", + "\n", + "0,0,1,2,3,1,2,3,5,3,7,8,8,5,10,9,15,11,18,19,20,8,5,13,15,10,6,10,6,7,4,9,3,5,2,5,3,2,2,1\n", + "\n", + "0,0,0,3,1,5,6,5,5,8,2,4,11,12,10,11,9,10,17,11,6,16,12,6,8,14,6,13,10,11,4,6,4,7,6,3,2,1,0,0\n", + "\n", + "0,1,1,2,1,3,5,3,5,8,6,8,12,5,13,6,13,8,16,8,18,15,16,14,12,7,3,8,9,11,2,5,4,5,1,4,1,2,0,0\n", + "\n", + "0,1,0,0,4,3,3,5,5,4,5,8,7,10,13,3,7,13,15,18,8,15,15,16,11,14,12,4,10,10,4,3,4,5,5,3,3,2,2,1\n", + "\n", + "0,1,0,0,3,4,2,7,8,5,2,8,11,5,5,8,14,11,6,11,9,16,18,6,12,5,4,3,5,7,8,3,5,4,5,5,4,0,1,1\n", + "\n", + "0,0,2,1,4,3,6,4,6,7,9,9,3,11,6,12,4,17,13,15,13,12,8,7,4,7,12,9,5,6,5,4,7,3,5,4,2,3,0,1\n", + "\n", + "0,0,0,0,1,3,1,6,6,5,5,6,3,6,13,3,10,13,9,16,15,9,11,4,6,4,11,11,12,3,5,8,7,4,6,4,1,3,0,0\n", + "\n", + "0,1,2,1,1,1,4,1,5,2,3,3,10,7,13,5,7,17,6,9,12,13,10,4,12,4,6,7,6,10,8,2,5,1,3,4,2,0,2,0\n", + "\n", + "0,1,1,0,1,2,4,3,6,4,7,5,5,7,5,10,7,8,18,17,9,8,12,11,11,11,14,6,11,2,10,9,5,6,5,3,4,2,2,0\n", + "\n", + "0,0,0,0,2,3,6,5,7,4,3,2,10,7,9,11,12,5,12,9,13,19,14,17,5,13,8,11,5,10,9,8,7,5,3,1,4,0,2,1\n", + "\n", + "0,0,0,1,2,1,4,3,6,7,4,2,12,6,12,4,14,7,8,14,13,19,6,9,12,6,4,13,6,7,2,3,6,5,4,2,3,0,1,0\n", + "\n", + "0,0,2,1,2,5,4,2,7,8,4,7,11,9,8,11,15,17,11,12,7,12,7,6,7,4,13,5,7,6,6,9,2,1,1,2,2,0,1,0\n", + "\n", + "0,1,2,0,1,4,3,2,2,7,3,3,12,13,11,13,6,5,9,16,9,19,16,11,8,9,14,12,11,9,6,6,6,1,1,2,4,3,1,1\n", + "\n", + "0,1,1,3,1,4,4,1,8,2,2,3,12,12,10,15,13,6,5,5,18,19,9,6,11,12,7,6,3,6,3,2,4,3,1,5,4,2,2,0\n", + "\n", + "0,0,2,3,2,3,2,6,3,8,7,4,6,6,9,5,12,12,8,5,12,10,16,7,14,12,5,4,6,9,8,5,6,6,1,4,3,0,2,0\n", + "\n", + "0,0,0,3,4,5,1,7,7,8,2,5,12,4,10,14,5,5,17,13,16,15,13,6,12,9,10,3,3,7,4,4,8,2,6,5,1,0,1,0\n", + "\n", + "0,1,1,1,1,3,3,2,6,3,9,7,8,8,4,13,7,14,11,15,14,13,5,13,7,14,9,10,5,11,5,3,5,1,1,4,4,1,2,0\n", + "\n", + "0,1,1,1,2,3,5,3,6,3,7,10,3,8,12,4,12,9,15,5,17,16,5,10,10,15,7,5,3,11,5,5,6,1,1,1,1,0,2,1\n", + "\n", + "0,0,2,1,3,3,2,7,4,4,3,8,12,9,12,9,5,16,8,17,7,11,14,7,13,11,7,12,12,7,8,5,7,2,2,4,1,1,1,0\n", + "\n", + "0,0,1,2,4,2,2,3,5,7,10,5,5,12,3,13,4,13,7,15,9,12,18,14,16,12,3,11,3,2,7,4,8,2,2,1,3,0,1,1\n", + "\n", + "0,0,1,1,1,5,1,5,2,2,4,10,4,8,14,6,15,6,12,15,15,13,7,17,4,5,11,4,8,7,9,4,5,3,2,5,4,3,2,1\n", + "\n", + "0,0,2,2,3,4,6,3,7,6,4,5,8,4,7,7,6,11,12,19,20,18,9,5,4,7,14,8,4,3,7,7,8,3,5,4,1,3,1,0\n", + "\n", + "0,0,0,1,4,4,6,3,8,6,4,10,12,3,3,6,8,7,17,16,14,15,17,4,14,13,4,4,12,11,6,9,5,5,2,5,2,1,0,1\n", + "\n", + "0,1,1,0,3,2,4,6,8,6,2,3,11,3,14,14,12,8,8,16,13,7,6,9,15,7,6,4,10,8,10,4,2,6,5,5,2,3,2,1\n", + "\n", + "0,0,2,3,3,4,5,3,6,7,10,5,10,13,14,3,8,10,9,9,19,15,15,6,8,8,11,5,5,7,3,6,6,4,5,2,2,3,0,0\n", + "\n", + "0,1,2,2,2,3,6,6,6,7,6,3,11,12,13,15,15,10,14,11,11,8,6,12,10,5,12,7,7,11,5,8,5,2,5,5,2,0,2,1\n", + "\n", + "0,0,2,1,3,5,6,7,5,8,9,3,12,10,12,4,12,9,13,10,10,6,10,11,4,15,13,7,3,4,2,9,7,2,4,2,1,2,1,1\n", + "\n", + "0,0,1,2,4,1,5,5,2,3,4,8,8,12,5,15,9,17,7,19,14,18,12,17,14,4,13,13,8,11,5,6,6,2,3,5,2,1,1,1\n", + "\n", + "0,0,0,3,1,3,6,4,3,4,8,3,4,8,3,11,5,7,10,5,15,9,16,17,16,3,8,9,8,3,3,9,5,1,6,5,4,2,2,0\n", + "\n", + "0,1,2,2,2,5,5,1,4,6,3,6,5,9,6,7,4,7,16,7,16,13,9,16,12,6,7,9,10,3,6,4,5,4,6,3,4,3,2,1\n", + "\n", + "0,1,1,2,3,1,5,1,2,2,5,7,6,6,5,10,6,7,17,13,15,16,17,14,4,4,10,10,10,11,9,9,5,4,4,2,1,0,1,0\n", + "\n", + "0,1,0,3,2,4,1,1,5,9,10,7,12,10,9,15,12,13,13,6,19,9,10,6,13,5,13,6,7,2,5,5,2,1,1,1,1,3,0,1\n", + "\n", + "0,1,1,3,1,1,5,5,3,7,2,2,3,12,4,6,8,15,16,16,15,4,14,5,13,10,7,10,6,3,2,3,6,3,3,5,4,3,2,1\n", + "\n", + "0,0,0,2,2,1,3,4,5,5,6,5,5,12,13,5,7,5,11,15,18,7,9,10,14,12,11,9,10,3,2,9,6,2,2,5,3,0,0,1\n", + "\n", + "0,0,1,3,3,1,2,1,8,9,2,8,10,3,8,6,10,13,11,17,19,6,4,11,6,12,7,5,5,4,4,8,2,6,6,4,2,2,0,0\n", + "\n", + "0,1,1,3,4,5,2,1,3,7,9,6,10,5,8,15,11,12,15,6,12,16,6,4,14,3,12,9,6,11,5,8,5,5,6,1,2,1,2,0\n", + "\n", + "0,0,1,3,1,4,3,6,7,8,5,7,11,3,6,11,6,10,6,19,18,14,6,10,7,9,8,5,8,3,10,2,5,1,5,4,2,1,0,1\n", + "\n", + "0,1,1,3,3,4,4,6,3,4,9,9,7,6,8,15,12,15,6,11,6,18,5,14,15,12,9,8,3,6,10,6,8,7,2,5,4,3,1,1\n", + "\n", + "0,1,2,2,4,3,1,4,8,9,5,10,10,3,4,6,7,11,16,6,14,9,11,10,10,7,10,8,8,4,5,8,4,4,5,2,4,1,1,0\n", + "\n", + "0,0,2,3,4,5,4,6,2,9,7,4,9,10,8,11,16,12,15,17,19,10,18,13,15,11,8,4,7,11,6,7,6,5,1,3,1,0,0,0\n", + "\n", + "0,1,1,3,1,4,6,2,8,2,10,3,11,9,13,15,5,15,6,10,10,5,14,15,12,7,4,5,11,4,6,9,5,6,1,1,2,1,2,1\n", + "\n", + "0,0,1,3,2,5,1,2,7,6,6,3,12,9,4,14,4,6,12,9,12,7,11,7,16,8,13,6,7,6,10,7,6,3,1,5,4,3,0,0\n", + "\n", + "0,0,1,2,3,4,5,7,5,4,10,5,12,12,5,4,7,9,18,16,16,10,15,15,10,4,3,7,5,9,4,6,2,4,1,4,2,2,2,1\n", + "\n", + "0,1,2,1,1,3,5,3,6,3,10,10,11,10,13,10,13,6,6,14,5,4,5,5,9,4,12,7,7,4,7,9,3,3,6,3,4,1,2,0\n", + "\n", + "0,1,2,2,3,5,2,4,5,6,8,3,5,4,3,15,15,12,16,7,20,15,12,8,9,6,12,5,8,3,8,5,4,1,3,2,1,3,1,0\n", + "\n", + "0,0,0,2,4,4,5,3,3,3,10,4,4,4,14,11,15,13,10,14,11,17,9,11,11,7,10,12,10,10,10,8,7,5,2,2,4,1,2,1\n", + "\n", + "0,0,2,1,1,4,4,7,2,9,4,10,12,7,6,6,11,12,9,15,15,6,6,13,5,12,9,6,4,7,7,6,5,4,1,4,2,2,2,1\n", + "\n", + "0,1,2,1,1,4,5,4,4,5,9,7,10,3,13,13,8,9,17,16,16,15,12,13,5,12,10,9,11,9,4,5,5,2,2,5,1,0,0,1\n", + "\n", + "0,0,1,3,2,3,6,4,5,7,2,4,11,11,3,8,8,16,5,13,16,5,8,8,6,9,10,10,9,3,3,5,3,5,4,5,3,3,0,1\n", + "\n", + "0,1,1,2,2,5,1,7,4,2,5,5,4,6,6,4,16,11,14,16,14,14,8,17,4,14,13,7,6,3,7,7,5,6,3,4,2,2,1,1\n", + "\n", + "0,1,1,1,4,1,6,4,6,3,6,5,6,4,14,13,13,9,12,19,9,10,15,10,9,10,10,7,5,6,8,6,6,4,3,5,2,1,1,1\n", + "\n", + "0,0,0,1,4,5,6,3,8,7,9,10,8,6,5,12,15,5,10,5,8,13,18,17,14,9,13,4,10,11,10,8,8,6,5,5,2,0,2,0\n", + "\n", + "0,0,1,0,3,2,5,4,8,2,9,3,3,10,12,9,14,11,13,8,6,18,11,9,13,11,8,5,5,2,8,5,3,5,4,1,3,1,1,0\n", + "\n" ] } ], @@ -129,11 +248,8 @@ "with open(all_paths[0], 'r') as f:\n", " contents = f.readlines()\n", "\n", - "data_list = []\n", "for i in contents:\n", - " data_list.append(i)\n", - "\n", - "print(data_list)" + " print(i)" ] }, { From 1b1fc012a6d3d80eed8985b30947eba3f0646bee Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 17:33:35 -0500 Subject: [PATCH 13/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 22 -------------------- 1 file changed, 22 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 7bc037382..3b2bc9c81 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -75,28 +75,6 @@ "```" ] }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "all_paths = [\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", - "]\n" - ] - }, { "cell_type": "markdown", "metadata": { From 4afa8fbdec2e8b902064b10483a96f26b1021222 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 17:46:54 -0500 Subject: [PATCH 14/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 3b2bc9c81..bef3f4821 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "metadata": { "id": "n0m48JsS-nMC" }, @@ -223,6 +223,20 @@ } ], "source": [ + "all_paths = [\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", + " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", + "]\n", "with open(all_paths[0], 'r') as f:\n", " contents = f.readlines()\n", "\n", From f1c3e63f4637c1e8528c98a956709a917ba85a76 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Thu, 5 Dec 2024 18:37:13 -0500 Subject: [PATCH 15/18] Assignment-2 Completed --- 02_activities/assignments/assignment_2.ipynb | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index bef3f4821..5f1e7939b 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { "id": "n0m48JsS-nMC" }, @@ -224,18 +224,18 @@ ], "source": [ "all_paths = [\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", - " \"C:/Users/15199/python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", + " \"../python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", + " \"../python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", "]\n", "with open(all_paths[0], 'r') as f:\n", " contents = f.readlines()\n", From 4c29e5d618a1abcf0f6458f57827971c205b2a4b Mon Sep 17 00:00:00 2001 From: Ranveer Date: Sat, 7 Dec 2024 09:28:05 -0500 Subject: [PATCH 16/18] Assignment-2 --- 02_activities/assignments/assignment_2.ipynb | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 5f1e7939b..e04c05447 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 1, "metadata": { "id": "n0m48JsS-nMC" }, @@ -224,18 +224,18 @@ ], "source": [ "all_paths = [\n", - " \"../python/05_src/data/assignment_2_data/inflammation_01.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_02.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_03.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_04.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_05.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_06.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_07.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_08.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_09.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_10.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_11.csv\",\n", - " \"../python/05_src/data/assignment_2_data/inflammation_12.csv\"\n", + " \"../../05_src/data/assignment_2_data/inflammation_01.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_02.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_03.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_04.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_05.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_06.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_07.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_08.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_09.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_10.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_11.csv\",\n", + " \"../../05_src/data/assignment_2_data/inflammation_12.csv\"\n", "]\n", "with open(all_paths[0], 'r') as f:\n", " contents = f.readlines()\n", @@ -275,7 +275,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "id": "82-bk4CBB1w4" }, @@ -307,7 +307,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 3, "metadata": { "id": "3TYo0-1SDLrd" }, @@ -382,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 4, "metadata": { "id": "_svDiRkdIwiT" }, @@ -405,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 5, "metadata": { "id": "LEYPM5v4JT0i" }, @@ -421,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 6, "metadata": {}, "outputs": [ { From f32973601ab8cce8bf5e90bddbcf4852a8cfa048 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Tue, 10 Dec 2024 07:06:09 -0500 Subject: [PATCH 17/18] Updated Assignment-2 --- 02_activities/assignments/assignment_2.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index e04c05447..d58adb3a0 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "id": "n0m48JsS-nMC" }, @@ -238,10 +238,10 @@ " \"../../05_src/data/assignment_2_data/inflammation_12.csv\"\n", "]\n", "with open(all_paths[0], 'r') as f:\n", - " contents = f.readlines()\n", - "\n", - "for i in contents:\n", - " print(i)" + " contents = f.readlines()\n", + " \n", + " for i in contents:\n", + " print(i)" ] }, { From 9c68ed8f5b306eb2ad1d86532c645d2aebd0e213 Mon Sep 17 00:00:00 2001 From: Ranveer Date: Tue, 10 Dec 2024 07:15:29 -0500 Subject: [PATCH 18/18] Original Assignment_1 --- 02_activities/assignments/assignment_1.ipynb | 281 +------------------ 1 file changed, 15 insertions(+), 266 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 977dbe1c5..14faec566 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -18,7 +18,7 @@ "🚨 **Please review our [Assignment Submission Guide](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md)** 🚨 for detailed instructions on how to format, branch, and submit your work. Following these guidelines is crucial for your submissions to be evaluated correctly.\n", "\n", "### Submission Parameters:\n", - "* Submission Due Date: `11:59 PM - Dec 1, 2024`\n", + "* Submission Due Date: `11:59 PM - Dec 2, 2024`\n", "* The branch name for your repo should be: `assignment-1`\n", "* What to submit for this assignment:\n", " * This Jupyter Notebook (assignment_1.ipynb) should be populated and should be the only change in your pull request.\n", @@ -56,124 +56,13 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 56, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# This is a function, which we will learn more about next week. For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", - "\n", - " # using list function to create a list of each letter in the word_a & word_b\n", - " # using string.lower() method to change the string to lowercase.\n", - " # sort function will sort the alphabets in ascending order which is default. It modifies the elements in a list and doesn't return the sorted list.\n", - " alphabet_list_a = list(word_a.lower())\n", - " alphabet_list_a.sort()\n", - " alphabet_list_b = list(word_b.lower())\n", - " alphabet_list_b.sort()\n", - "\n", - " # == is for comparing two lists. It compares two lists elementwise. \n", - " return(alphabet_list_a == alphabet_list_b)\n", - "\n", - "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 57, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "anagram_checker(\"Silent\", \"Night\")" - ] - }, - { - "cell_type": "code", - "execution_count": 58, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 58, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "anagram_checker(\"night\", \"Thing\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Solution# 2\n", - "Using for loop" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 62, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def anagram_checker(word_a, word_b):\n", - " \n", - " # Creatinig an empty list and changing word_a to lowercase\n", - " alphabet_list_a = []\n", - " word_a = word_a.lower()\n", - "\n", - "# for loop goes through each index of the string (from 0 to (length - 1)) \n", - "# 1. It retrieves the letter at the current index\n", - "# 2. Adds the letter to the list. For each iteration, it keeps adding the letters to the updated list from the previous iteration. \n", - " for i in range(0, len(word_a)):\n", - " alphabet_list_a.append(word_a[i])\n", - "\n", - " alphabet_list_b = []\n", - " word_b = word_b.lower()\n", - " \n", - " for i in range(0, len(word_b)):\n", - " alphabet_list_b.append(word_b[i])\n", - "\n", - " # == is for comparing two lists. It compares two lists elementwise. \n", - " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", + " # Your code here\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -181,40 +70,18 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 63, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "anagram_checker(\"Silent\", \"Night\")" ] }, { "cell_type": "code", - "execution_count": 64, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 64, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "anagram_checker(\"night\", \"Thing\")" ] @@ -230,119 +97,12 @@ }, { "cell_type": "code", - "execution_count": 65, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 65, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - "\n", - "# Using if else to set the conditions about the case sensitivity\n", - " if is_case_sensitive == False:\n", - " \n", - " alphabet_list_a = list(word_a.lower())\n", - " alphabet_list_a.sort()\n", - " alphabet_list_b = list(word_b.lower())\n", - " alphabet_list_b.sort()\n", - "\n", - " return(alphabet_list_a == alphabet_list_b)\n", - "\n", - " else:\n", - " \n", - " alphabet_list_a = list(word_a)\n", - " alphabet_list_a.sort()\n", - " alphabet_list_b = list(word_b)\n", - " alphabet_list_b.sort()\n", - "\n", - " return(alphabet_list_a == alphabet_list_b)\n", - "\n", - "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\", False) # True" - ] - }, - { - "cell_type": "code", - "execution_count": 66, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "anagram_checker(\"Silent\", \"Listen\", True) # False" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Modifying Solution# 2" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 67, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - "\n", - " if is_case_sensitive == False:\n", - "\n", - " alphabet_list_a = []\n", - " word_a = word_a.lower()\n", - "\n", - " for i in range(0, len(word_a)):\n", - " alphabet_list_a.append(word_a[i])\n", - "\n", - " alphabet_list_b = []\n", - " word_b = word_b.lower()\n", - " \n", - " for i in range(0, len(word_b)):\n", - " alphabet_list_b.append(word_b[i])\n", - "\n", - " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", - "\n", - " else:\n", - "\n", - " alphabet_list_a = []\n", - " for i in range(0, len(word_a)):\n", - " alphabet_list_a.append(word_a[i])\n", - "\n", - " alphabet_list_b = []\n", - " for i in range(0, len(word_b)):\n", - " alphabet_list_b.append(word_b[i])\n", - "\n", - " return(sorted(alphabet_list_a) == sorted(alphabet_list_b))\n", + " # Modify your existing code here\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -350,20 +110,9 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 68, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] @@ -381,7 +130,7 @@ ], "metadata": { "kernelspec": { - "display_name": "dsi_participant", + "display_name": "new-learner", "language": "python", "name": "python3" }, @@ -395,7 +144,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.15" + "version": "3.11.8" } }, "nbformat": 4,