From 9fd1479459854f615734fcf87a57290c571f30a4 Mon Sep 17 00:00:00 2001 From: Alan Thankachan Date: Sun, 24 Aug 2025 19:35:20 -0700 Subject: [PATCH] Updated the anagram function --- 02_activities/assignments/assignment_1.ipynb | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 2793c20e8..1e74e9fa3 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -65,7 +65,7 @@ "True" ] }, - "execution_count": 24, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -74,9 +74,10 @@ "# 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", " first_word = sorted(word_a.lower())\n", " second_word = sorted(word_b.lower())\n", - "\n", + " \n", " return first_word == second_word\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -84,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -93,7 +94,7 @@ "False" ] }, - "execution_count": 25, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -104,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -113,7 +114,7 @@ "True" ] }, - "execution_count": 26, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -133,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -142,7 +143,7 @@ "True" ] }, - "execution_count": 27, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -150,10 +151,11 @@ "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", " # Modify your existing code here\n", + " \n", " if not is_case_sensitive:\n", " word_a = word_a.lower()\n", " word_b = word_b.lower()\n", - "\n", + " \n", " return sorted(word_a) == sorted(word_b)\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -161,7 +163,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -170,7 +172,7 @@ "False" ] }, - "execution_count": 28, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" }