From 97b6efb0e97ce16922996d712f1de79266e4beec Mon Sep 17 00:00:00 2001 From: Angel Date: Wed, 22 Oct 2025 16:22:48 -0400 Subject: [PATCH 1/4] Completed Anagram task - Attempt #1 --- 02_activities/assignments/assignment_1.ipynb | 102 +++++++++++++++---- 1 file changed, 82 insertions(+), 20 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index bee48d5a0..9313a681b 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,34 +56,69 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", - " # Your code here\n", + " word_a = sorted(word_a.lower())\n", + " word_b = sorted(word_b.lower())\n", + " return word_a == word_b\n", "\n", "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\")" + "anagram_checker(\"Earth\", \"heart\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "anagram_checker(\"Silent\", \"Night\")" + "anagram_checker(\"Trumpet\", \"Violin\")" ] }, { "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\")" + "anagram_checker(\"note\", \"Tone\")" ] }, { @@ -97,24 +132,51 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - " # Modify your existing code here\n", - "\n", + " if is_case_sensitive == False: # Checks if the comparison is case insensitive\n", + " word_a = sorted(word_a.lower())\n", + " word_b = sorted(word_b.lower())\n", + " else: # If case sensitive, it sorts without using .lower()\n", + " word_a = sorted(word_a)\n", + " word_b = sorted(word_b)\n", + " return word_a == word_b # returns comparison result\n", "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\", False) # True" + "anagram_checker(\"Earth\", \"heart\", False) # True" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "anagram_checker(\"Silent\", \"Listen\", True) # False" + "anagram_checker(\"Note\", \"Tone\", True) # False" ] }, { @@ -130,7 +192,7 @@ ], "metadata": { "kernelspec": { - "display_name": "new-learner", + "display_name": "python-env (3.11.2)", "language": "python", "name": "python3" }, @@ -144,7 +206,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.2" } }, "nbformat": 4, From cb656a1d6b67999339f0d1e9ebd25dda44d1b327 Mon Sep 17 00:00:00 2001 From: Angel Date: Wed, 22 Oct 2025 16:37:29 -0400 Subject: [PATCH 2/4] Completed Anagram task - Attempt #2 - Updated comments --- 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 9313a681b..4514e9b18 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -73,9 +73,9 @@ "source": [ "# For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", - " word_a = sorted(word_a.lower())\n", - " word_b = sorted(word_b.lower())\n", - " return word_a == word_b\n", + " word_a = sorted(word_a.lower()) # Sorts and converts to lowercase\n", + " word_b = sorted(word_b.lower()) # Sorts and converts to lowercase\n", + " return word_a == word_b # returns comparison result\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Earth\", \"heart\")" From 07d6408aca0317a207d230de8b597eadf8a5675e Mon Sep 17 00:00:00 2001 From: Angel Date: Tue, 28 Oct 2025 06:18:49 -0400 Subject: [PATCH 3/4] Finished assignment - #1 git add 02_activities/assignments/assignment_2.ipynb --- 02_activities/assignments/assignment_2.ipynb | 193 +++++++++++++++++-- 1 file changed, 174 insertions(+), 19 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index 36a3e2bb7..e5e814486 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -57,6 +57,11 @@ "\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, { "cell_type": "markdown", "metadata": { @@ -76,8 +81,137 @@ "metadata": { "id": "n0m48JsS-nMC" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0,0,0,1,3,4,6,5,2,7,7,8,6,11,5,6,10,4,5,9,15,15,14,13,14,12,10,9,8,8,6,6,6,6,5,4,2,1,1,0\n", + "\n", + "0,0,2,2,4,2,1,7,5,7,3,6,10,5,5,14,14,9,11,10,5,5,5,15,6,6,10,13,6,8,3,5,7,7,3,2,2,0,2,1\n", + "\n", + "0,1,2,3,2,1,4,1,8,7,4,5,10,3,11,5,11,8,18,4,17,9,5,6,15,14,11,5,6,4,7,2,5,6,4,5,4,0,2,1\n", + "\n", + "0,0,0,0,1,2,4,7,3,5,8,7,5,13,10,7,11,8,18,6,13,4,10,13,5,5,4,3,8,9,2,3,2,3,5,3,1,3,1,1\n", + "\n", + "0,1,0,2,1,2,3,6,5,2,9,3,5,12,9,5,8,11,9,4,19,19,15,9,6,12,9,3,6,2,9,9,8,5,3,5,3,0,2,1\n", + "\n", + "0,0,1,3,4,4,2,2,6,3,2,9,4,11,12,8,6,8,8,7,18,11,13,13,10,5,7,11,3,6,9,6,4,5,1,4,1,0,0,0\n", + "\n", + "0,1,0,3,2,3,2,2,4,6,4,11,11,8,3,9,11,7,12,16,10,5,17,8,11,15,6,8,11,10,6,9,4,3,3,3,1,3,1,1\n", + "\n", + "0,1,2,1,4,1,2,7,2,2,8,9,5,6,12,12,6,14,6,5,12,11,11,5,10,7,6,6,10,2,4,5,8,3,5,3,3,0,0,1\n", + "\n", + "0,0,1,2,2,1,4,2,7,4,10,6,4,3,6,5,8,13,8,8,12,4,13,4,13,4,14,5,12,10,6,3,2,1,5,3,4,3,2,0\n", + "\n", + "0,1,1,1,4,2,1,3,5,3,2,3,11,3,4,5,14,4,5,8,18,18,13,5,11,4,13,12,11,4,10,9,3,3,6,3,2,0,2,0\n", + "\n", + "0,1,0,0,2,3,5,2,5,8,4,7,7,8,5,5,8,15,14,4,10,12,8,14,11,14,5,13,4,6,8,3,6,5,5,2,4,2,2,1\n", + "\n", + "0,1,2,3,2,5,6,4,2,4,6,9,6,9,6,6,14,11,6,18,6,13,18,7,15,13,3,12,8,8,5,2,5,7,4,2,2,3,2,0\n", + "\n", + "0,0,0,1,4,1,4,1,7,7,8,7,7,4,9,3,8,17,17,9,13,19,5,10,8,7,5,3,7,4,6,5,4,1,5,2,1,0,0,0\n", + "\n", + "0,0,2,1,1,4,5,7,8,5,5,3,6,9,7,8,10,10,13,19,18,15,4,11,6,4,8,11,7,5,4,3,7,3,5,4,4,0,1,0\n", + "\n", + "0,1,0,3,4,3,3,7,6,8,4,11,6,10,10,7,12,9,11,17,10,16,17,4,5,8,4,8,10,8,5,5,4,7,4,2,3,1,0,1\n", + "\n", + "0,0,0,3,1,3,5,1,6,5,3,4,8,11,11,3,4,12,14,17,7,9,4,8,8,15,3,12,9,10,6,6,3,3,2,5,4,3,1,0\n", + "\n", + "0,1,0,0,4,5,5,6,8,9,2,11,4,13,5,15,13,5,13,7,7,5,12,4,12,10,7,4,4,10,10,7,8,2,4,3,4,0,1,1\n", + "\n", + "0,0,2,0,2,3,2,4,4,3,10,5,8,9,8,12,15,10,9,4,17,5,13,12,15,5,8,10,9,5,3,9,4,2,6,4,2,0,1,1\n", + "\n", + "0,0,2,1,3,4,3,2,7,3,5,7,9,8,6,3,7,12,13,15,20,7,5,17,13,5,5,13,8,6,8,4,5,1,1,5,3,2,1,1\n", + "\n", + "0,0,0,3,4,2,2,5,2,8,6,10,7,13,7,11,10,6,12,14,8,7,9,12,11,5,5,13,7,7,4,9,4,7,2,1,2,3,0,1\n", + "\n", + "0,1,1,2,4,1,6,3,8,8,8,9,8,7,12,9,5,7,9,11,8,7,11,6,8,13,14,5,3,7,10,6,8,6,5,4,4,2,0,0\n", + "\n", + "0,0,2,3,3,1,5,3,3,6,8,4,12,8,12,11,14,9,5,7,11,13,13,4,13,12,14,6,7,5,3,4,3,1,1,3,4,3,2,1\n", + "\n", + "0,1,2,3,2,4,1,3,6,2,10,11,7,3,9,6,11,15,4,19,16,9,18,4,6,12,6,5,9,6,9,5,2,4,6,2,1,3,2,1\n", + "\n", + "0,1,0,3,4,5,6,5,4,3,3,9,9,13,10,12,14,7,15,16,15,7,15,6,9,7,10,9,4,8,2,6,8,2,6,4,1,3,0,1\n", + "\n", + "0,1,0,1,4,2,2,7,7,8,7,11,9,5,5,6,14,7,6,14,8,17,5,13,8,6,13,13,10,10,4,2,2,7,6,3,4,1,1,1\n", + "\n", + "0,0,2,2,2,4,3,7,6,9,10,10,3,5,14,14,9,15,16,17,15,10,4,14,12,6,8,12,4,3,6,4,8,3,2,5,1,1,2,1\n", + "\n", + "0,1,0,2,3,5,3,6,3,7,6,5,11,7,14,9,7,8,6,4,12,5,12,6,5,6,3,7,3,8,7,7,4,7,5,3,2,2,2,0\n", + "\n", + "0,1,1,0,2,3,4,1,3,8,8,8,7,6,6,11,13,9,9,9,10,14,8,5,13,4,5,3,3,2,9,2,2,6,5,2,1,1,1,1\n", + "\n", + "0,0,2,3,4,5,2,3,8,6,6,5,10,8,7,15,14,6,6,6,8,7,12,10,7,12,5,8,12,11,4,5,5,6,6,2,2,2,0,0\n", + "\n", + "0,0,1,1,3,2,4,3,4,8,4,3,4,13,11,14,6,6,15,16,10,19,10,15,14,13,7,9,4,2,6,8,2,1,1,5,4,2,1,1\n", + "\n", + "0,1,0,2,2,2,3,1,4,9,9,2,5,6,13,7,13,8,17,15,7,13,11,13,9,5,7,13,10,5,9,3,8,4,6,1,2,3,1,1\n", + "\n", + "0,0,1,1,1,3,5,4,2,2,6,10,9,9,5,5,5,11,18,18,6,14,12,8,15,5,4,4,11,4,5,7,3,4,6,3,2,1,2,1\n", + "\n", + "0,1,0,2,2,5,2,3,2,9,4,2,12,11,6,4,9,11,4,18,19,5,4,6,7,7,10,13,9,2,8,4,3,5,4,2,3,0,0,1\n", + "\n", + "0,1,1,3,2,5,2,5,2,2,9,5,10,11,14,14,15,8,4,13,6,13,11,13,9,5,10,12,8,8,2,2,2,2,6,5,3,1,1,0\n", + "\n", + "0,1,1,2,2,3,2,7,7,8,7,9,4,5,3,9,8,8,11,19,5,16,13,7,16,12,8,7,11,8,3,4,6,1,1,1,4,3,1,0\n", + "\n", + "0,1,1,2,4,4,4,4,4,5,5,11,3,5,6,13,8,14,5,14,9,6,9,15,9,6,4,7,4,6,7,2,4,4,4,3,1,2,0,1\n", + "\n", + "0,0,2,1,1,1,4,7,3,2,9,7,11,4,5,4,16,16,9,4,16,5,16,17,4,9,6,4,10,11,9,9,6,4,6,1,1,0,2,1\n", + "\n", + "0,0,1,1,3,1,4,4,4,7,9,2,3,11,5,10,12,8,6,6,16,13,10,6,7,10,9,7,4,6,5,7,4,3,6,3,1,2,1,1\n", + "\n", + "0,0,1,0,3,3,1,7,4,8,8,2,12,5,12,15,4,12,12,13,20,8,14,5,14,15,6,5,4,4,6,9,5,1,2,1,4,2,0,0\n", + "\n", + "0,1,0,1,4,2,2,5,4,7,3,11,3,12,11,6,4,15,15,16,8,4,16,15,8,7,12,10,5,5,9,5,8,1,3,4,4,2,0,0\n", + "\n", + "0,0,1,2,3,5,4,6,7,7,2,8,9,6,4,9,7,14,6,11,17,16,13,12,16,12,6,5,8,3,8,5,3,1,4,3,1,2,0,1\n", + "\n", + "0,1,2,3,1,3,5,2,2,4,5,9,12,4,7,13,15,4,15,12,15,18,5,16,4,15,8,9,4,9,2,2,6,1,2,3,3,2,1,0\n", + "\n", + "0,1,1,1,2,2,6,3,5,2,10,4,7,13,3,5,14,10,9,16,18,11,15,5,9,14,8,4,3,3,2,8,4,1,4,1,1,1,2,1\n", + "\n", + "0,1,1,2,1,1,5,3,5,4,9,8,11,3,5,15,6,6,8,19,8,15,18,10,12,10,10,6,9,3,10,9,7,6,3,3,1,2,0,0\n", + "\n", + "0,1,2,0,2,1,4,1,5,7,3,2,5,6,6,9,4,17,11,10,16,12,17,13,10,7,13,6,8,9,8,3,8,2,6,1,1,3,2,0\n", + "\n", + "0,0,1,2,3,2,3,5,3,9,8,4,3,9,8,14,6,15,13,4,17,8,9,17,9,5,6,8,10,6,3,7,4,4,3,1,1,0,2,0\n", + "\n", + "0,1,1,0,1,1,2,7,8,6,4,4,9,3,10,14,14,11,6,8,18,5,13,10,4,5,3,12,9,7,8,8,2,4,3,4,3,2,1,1\n", + "\n", + "0,0,0,1,1,1,4,2,5,4,10,9,7,9,3,15,12,6,14,17,16,18,5,8,10,12,10,11,11,8,10,9,8,5,1,3,4,3,0,1\n", + "\n", + "0,0,0,2,4,4,1,2,7,4,7,7,10,7,14,9,6,17,8,8,8,9,6,15,15,12,10,9,11,6,4,7,7,2,4,1,4,1,1,1\n", + "\n", + "0,1,1,1,1,1,1,3,3,4,10,2,6,7,12,8,6,5,11,19,8,10,6,9,15,7,13,7,10,3,3,8,2,2,1,3,2,0,2,1\n", + "\n", + "0,1,1,2,2,4,5,3,4,6,2,3,10,3,7,15,10,8,12,7,13,12,9,7,8,4,9,8,12,10,6,2,4,3,4,3,3,1,0,0\n", + "\n", + "0,0,0,1,3,2,6,5,6,6,7,8,3,13,5,12,4,12,10,18,13,7,7,4,15,13,5,8,10,3,7,6,3,4,5,5,2,1,1,0\n", + "\n", + "0,0,1,0,2,2,3,3,4,8,5,2,8,7,9,7,9,4,7,4,6,11,10,10,8,14,4,5,3,10,6,5,8,3,6,2,3,3,2,0\n", + "\n", + "0,0,2,2,2,1,6,4,4,2,2,3,7,4,8,15,8,12,17,10,17,8,13,13,8,7,3,9,6,2,3,4,8,2,1,1,2,1,2,0\n", + "\n", + "0,0,0,1,4,2,1,4,8,7,7,10,12,5,4,4,12,7,18,9,16,19,11,7,14,8,11,11,10,9,9,8,4,7,6,5,2,2,1,1\n", + "\n", + "0,0,2,2,4,2,3,6,4,5,4,2,5,4,11,13,4,10,16,16,6,16,7,14,5,7,11,10,12,10,8,6,4,1,2,2,4,1,2,0\n", + "\n", + "0,1,0,2,2,1,6,2,2,2,9,5,9,12,5,12,10,13,9,4,17,14,5,10,12,3,13,4,9,8,8,6,7,4,4,5,4,0,2,0\n", + "\n", + "0,0,2,0,4,3,5,5,6,9,4,5,4,3,10,3,7,11,12,10,19,16,17,14,16,9,12,5,10,11,6,7,7,3,3,1,1,0,2,0\n", + "\n", + "0,0,0,3,3,1,5,7,7,7,6,8,7,6,10,14,6,12,5,15,20,18,14,17,14,11,13,10,9,5,5,5,5,7,1,5,3,2,2,0\n", + "\n", + "0,1,2,0,4,5,6,6,2,5,10,10,3,7,13,9,5,16,6,18,15,10,13,11,12,15,10,12,3,8,8,7,5,6,2,5,2,3,2,0\n", + "\n" + ] + } + ], "source": [ + "\n", + "\n", "all_paths = [\n", " \"../../05_src/data/assignment_2_data/inflammation_01.csv\",\n", " \"../../05_src/data/assignment_2_data/inflammation_02.csv\",\n", @@ -93,10 +227,10 @@ " \"../../05_src/data/assignment_2_data/inflammation_12.csv\"\n", "]\n", "\n", - "with open(all_paths[0], 'r') as f:\n", - " # YOUR CODE HERE: Use the readline() or readlines() method to read the .csv file into a variable\n", - " \n", - " # YOUR CODE HERE: Iterate through the variable using a for loop and print each row for inspection" + "with open(all_paths[1], 'r') as f:\n", + " patient_data = f.readlines() # Creates new variable\n", + " for row in patient_data:\n", + " print(row) # Prints each line in the file for inspection" ] }, { @@ -144,28 +278,39 @@ "\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", + " mean_values = np.mean(data, axis=ax)\n", + " return mean_values # 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", + " max_values = np.max(data, axis=ax)\n", + " return max_values # 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", + " min_values = np.min(data, axis=ax)\n", + " return min_values # 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" + " return summary_values \n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": { "id": "3TYo0-1SDLrd" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "60\n" + ] + } + ], "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", @@ -228,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": { "id": "_svDiRkdIwiT" }, @@ -260,16 +405,25 @@ "# 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" + " mean_sum = patient_summary(file_path, 'mean') # Create array for check_zeros\n", + " zero_helper = check_zeros(mean_sum) # Runs helpe function\n", + " \n", + " return zero_helper " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 41, "metadata": {}, - "outputs": [], + "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", @@ -314,7 +468,8 @@ "provenance": [] }, "kernelspec": { - "display_name": "Python 3", + "display_name": "python-env (3.11.2)", + "language": "python", "name": "python3" }, "language_info": { @@ -327,7 +482,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.2" } }, "nbformat": 4, From ad274ef03540ce2aa1a2c1b1d0d609db1998f583 Mon Sep 17 00:00:00 2001 From: Angel Date: Tue, 28 Oct 2025 06:50:11 -0400 Subject: [PATCH 4/4] Finished task 2 - Attempet #2' --- 02_activities/assignments/assignment_2.ipynb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index e5e814486..9201046b9 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -77,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "id": "n0m48JsS-nMC" }, @@ -403,17 +403,16 @@ "outputs": [], "source": [ "# Define your function `detect_problems` here\n", - "\n", "def detect_problems(file_path):\n", " mean_sum = patient_summary(file_path, 'mean') # Create array for check_zeros\n", - " zero_helper = check_zeros(mean_sum) # Runs helpe function\n", + " zero_helper = check_zeros(mean_sum) # Runs helper function\n", " \n", - " return zero_helper " + " return zero_helper " ] }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 42, "metadata": {}, "outputs": [ {