From 653eeeb6a9c7659f2b226b3a3968f3d90bfb60ae Mon Sep 17 00:00:00 2001 From: Kanza Batool Date: Fri, 13 Mar 2026 13:28:14 -0400 Subject: [PATCH 1/2] commiting assignment 1 --- 02_activities/assignments/assignment_1.ipynb | 124 ++++++++++++++++--- 1 file changed, 105 insertions(+), 19 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 2dca19d0b..d756b9990 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,34 +56,74 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 52, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 52, + "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", - "\n", + " # turn word_a into lowercase\n", + " # word_a = word_a.lower()\n", + "# turn word_b into lowercase\n", + " # word_b = word_b.lower() \n", + "# check to see if word_a and word_b have the same letters now that everything is in lowercase\n", + " # return sorted(word_a) == sorted(word_b) \n", + "# alternative shorter line \n", + " return (sorted(word_a.lower()) == sorted(word_b.lower()))\n", "# Run your code to check using the words below:\n", - "anagram_checker(\"Silent\", \"listen\")" + "anagram_checker(\"Silent\", \"listen\") # TRUE" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 53, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "anagram_checker(\"Silent\", \"Night\")" + "anagram_checker(\"Silent\", \"Night\") # FALSE" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 54, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "anagram_checker(\"night\", \"Thing\")" + "anagram_checker(\"night\", \"Thing\") # TRUE" ] }, { @@ -97,31 +137,77 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 55, + "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 == True: \n", + " #case matters and upper and lower case are NOT the same\n", + " if sorted(word_a) == sorted(word_b):\n", + " return True\n", + " else: \n", + " return False\n", + " else: \n", + " #case does not matter and upper and lower case ARE the same\n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", + " if sorted(word_a) == sorted (word_b):\n", + " return True\n", + " else:\n", + " return False\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 56, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"listen\", True) # False" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 57, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] @@ -139,7 +225,7 @@ ], "metadata": { "kernelspec": { - "display_name": "new-learner", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -153,7 +239,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.4" } }, "nbformat": 4, From 7a56787ed4f2776804dffe37a5bbe2b00f8c1647 Mon Sep 17 00:00:00 2001 From: Kanza Batool Date: Mon, 16 Mar 2026 14:03:07 -0400 Subject: [PATCH 2/2] Commiting revisions to original assignment based on TA feedback. --- 02_activities/assignments/assignment_1.ipynb | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index d756b9990..83a9711cf 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -137,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -146,7 +146,7 @@ "True" ] }, - "execution_count": 55, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -154,27 +154,31 @@ "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", " # Modify your existing code here\n", - " if is_case_sensitive == True: \n", - " #case matters and upper and lower case are NOT the same\n", - " if sorted(word_a) == sorted(word_b):\n", - " return True\n", - " else: \n", - " return False\n", - " else: \n", - " #case does not matter and upper and lower case ARE the same\n", + " if not is_case_sensitive: \n", " word_a = word_a.lower()\n", " word_b = word_b.lower()\n", - " if sorted(word_a) == sorted (word_b):\n", - " return True\n", - " else:\n", - " return False\n", + " return sorted(word_a) == sorted(word_b)\n", + " #if is_case_sensitive == True: \n", + " #case matters and upper and lower case are NOT the same\n", + " #if sorted(word_a) == sorted(word_b):\n", + " #return True\n", + " #else: \n", + " #return False\n", + " #else: \n", + " #case does not matter and upper and lower case ARE the same\n", + " #word_a = word_a.lower()\n", + " #word_b = word_b.lower()\n", + " #if sorted(word_a) == sorted (word_b):\n", + " #return True\n", + " #else:\n", + " #return False\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" ] }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -183,7 +187,7 @@ "False" ] }, - "execution_count": 56, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -194,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -203,7 +207,7 @@ "False" ] }, - "execution_count": 57, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -225,7 +229,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "python-env", "language": "python", "name": "python3" },