From 477dce081fe43d138bf732b71a2030085f9f112e Mon Sep 17 00:00:00 2001 From: NehaBondade Date: Mon, 1 Dec 2025 16:12:34 -0500 Subject: [PATCH 1/4] assignment_1 --- 02_activities/assignments/assignment_1.ipynb | 110 ++++++++++++++++--- 1 file changed, 96 insertions(+), 14 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 625be0241..cbdcf9226 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -44,7 +44,7 @@ "\n", "Examples of anagrams:\n", "* Silent and Listen\n", - "* Night and Think\n", + "* Night and Thing\n", "\n", "Example outputs:\n", "```python\n", @@ -58,11 +58,27 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"silent\" and \"listen\" are anagrams.\n" + ] + } + ], "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", + " # Normalize the words by converting them to lowercase\n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", + " \n", + " # Sorting the letters of both words and comparing them\n", + " if sorted(word_a) == sorted(word_b):\n", + " print(f'\"{word_a}\" and \"{word_b}\" are anagrams.')\n", + " else:\n", + " print(f'\"{word_a}\" and \"{word_b}\" are not anagrams.')\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -70,18 +86,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"silent\" and \"night\" are not anagrams.\n" + ] + } + ], "source": [ "anagram_checker(\"Silent\", \"Night\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"night\" and \"thing\" are anagrams.\n" + ] + } + ], "source": [ "anagram_checker(\"night\", \"Thing\")" ] @@ -97,12 +129,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - " # Modify your existing code here\n", + " if not is_case_sensitive:\n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", + " \n", + " if sorted(word_a) == sorted(word_b):\n", + " return True\n", + " else:\n", + " return False\n", + " \n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -110,9 +161,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"Silent\", \"listen\", True) # False" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] @@ -130,7 +212,7 @@ ], "metadata": { "kernelspec": { - "display_name": "new-learner", + "display_name": "python-env", "language": "python", "name": "python3" }, @@ -144,7 +226,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.12.8" } }, "nbformat": 4, From 002601a1ed9dc504b15005ddf00705cbe5934c1a Mon Sep 17 00:00:00 2001 From: NehaBondade Date: Mon, 1 Dec 2025 16:19:39 -0500 Subject: [PATCH 2/4] assignment_1 --- 02_activities/assignments/assignment_1.ipynb | 37 ++++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index cbdcf9226..b470d60c1 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -69,16 +69,16 @@ ], "source": [ "# For testing purposes, we will write our code in the function\n", - "def anagram_checker(word_a, word_b):\n", + "def anagram_checker(word_one, word_two):\n", " # Normalize the words by converting them to lowercase\n", - " word_a = word_a.lower()\n", - " word_b = word_b.lower()\n", + " word_one = word_one.lower()\n", + " word_two = word_two.lower()\n", " \n", " # Sorting the letters of both words and comparing them\n", - " if sorted(word_a) == sorted(word_b):\n", - " print(f'\"{word_a}\" and \"{word_b}\" are anagrams.')\n", + " if sorted(word_one) == sorted(word_two):\n", + " print(f'\"{word_one}\" and \"{word_two}\" are anagrams.')\n", " else:\n", - " print(f'\"{word_a}\" and \"{word_b}\" are not anagrams.')\n", + " print(f'\"{word_one}\" and \"{word_two}\" are not anagrams.')\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -86,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -129,7 +129,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -144,12 +144,12 @@ } ], "source": [ - "def anagram_checker(word_a, word_b, is_case_sensitive):\n", + "def anagram_checker(word_one, word_two, is_case_sensitive):\n", " if not is_case_sensitive:\n", - " word_a = word_a.lower()\n", - " word_b = word_b.lower()\n", + " word_one = word_one.lower()\n", + " word_two = word_two.lower()\n", " \n", - " if sorted(word_a) == sorted(word_b):\n", + " if sorted(word_one) == sorted(word_two):\n", " return True\n", " else:\n", " return False\n", @@ -161,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -181,7 +181,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -196,6 +196,13 @@ } ], "source": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "anagram_checker(\"Silent\", \"Listen\", True) # False" ] }, From 66fa7075609abd5fabc9d46375828a8b64b0afed Mon Sep 17 00:00:00 2001 From: NehaBondade Date: Mon, 1 Dec 2025 16:21:29 -0500 Subject: [PATCH 3/4] assignment_1 --- 02_activities/assignments/assignment_1.ipynb | 37 ++++++++------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index b470d60c1..cbdcf9226 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -69,16 +69,16 @@ ], "source": [ "# For testing purposes, we will write our code in the function\n", - "def anagram_checker(word_one, word_two):\n", + "def anagram_checker(word_a, word_b):\n", " # Normalize the words by converting them to lowercase\n", - " word_one = word_one.lower()\n", - " word_two = word_two.lower()\n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", " \n", " # Sorting the letters of both words and comparing them\n", - " if sorted(word_one) == sorted(word_two):\n", - " print(f'\"{word_one}\" and \"{word_two}\" are anagrams.')\n", + " if sorted(word_a) == sorted(word_b):\n", + " print(f'\"{word_a}\" and \"{word_b}\" are anagrams.')\n", " else:\n", - " print(f'\"{word_one}\" and \"{word_two}\" are not anagrams.')\n", + " print(f'\"{word_a}\" and \"{word_b}\" are not anagrams.')\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -86,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -129,7 +129,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -144,12 +144,12 @@ } ], "source": [ - "def anagram_checker(word_one, word_two, is_case_sensitive):\n", + "def anagram_checker(word_a, word_b, is_case_sensitive):\n", " if not is_case_sensitive:\n", - " word_one = word_one.lower()\n", - " word_two = word_two.lower()\n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", " \n", - " if sorted(word_one) == sorted(word_two):\n", + " if sorted(word_a) == sorted(word_b):\n", " return True\n", " else:\n", " return False\n", @@ -161,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -181,7 +181,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -196,13 +196,6 @@ } ], "source": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", "anagram_checker(\"Silent\", \"Listen\", True) # False" ] }, From 3163002d7c68ec56183d548740668cac8eab6c19 Mon Sep 17 00:00:00 2001 From: NehaBondade Date: Tue, 2 Dec 2025 12:24:38 -0500 Subject: [PATCH 4/4] assignment_1 --- 02_activities/assignments/assignment_1.ipynb | 69 ++++++++++---------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index cbdcf9226..b3d3d721b 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,15 +56,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\"silent\" and \"listen\" are anagrams.\n" - ] + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -75,10 +78,7 @@ " word_b = word_b.lower()\n", " \n", " # Sorting the letters of both words and comparing them\n", - " if sorted(word_a) == sorted(word_b):\n", - " print(f'\"{word_a}\" and \"{word_b}\" are anagrams.')\n", - " else:\n", - " print(f'\"{word_a}\" and \"{word_b}\" are not anagrams.')\n", + " return sorted(word_a) == sorted(word_b)\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -86,15 +86,18 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\"silent\" and \"night\" are not anagrams.\n" - ] + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -103,15 +106,18 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\"night\" and \"thing\" are anagrams.\n" - ] + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -129,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -138,7 +144,7 @@ "True" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -149,11 +155,8 @@ " word_a = word_a.lower()\n", " word_b = word_b.lower()\n", " \n", - " if sorted(word_a) == sorted(word_b):\n", - " return True\n", - " else:\n", - " return False\n", - " \n", + " return sorted(word_a) == sorted(word_b)\n", + "\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -161,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -170,7 +173,7 @@ "False" ] }, - "execution_count": 6, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -181,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -190,7 +193,7 @@ "False" ] }, - "execution_count": 7, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" }