diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 625be024..1f668003 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -43,7 +43,7 @@ "Given two valid strings, check to see if they are anagrams of each other. If it is, return `True`, else `False`. For this part, we can assume that uppercase letters are the same as if it was a lowercase character.\n", "\n", "Examples of anagrams:\n", - "* Silent and Listen\n", + "* Silent and Listen\n", "* Night and Think\n", "\n", "Example outputs:\n", @@ -63,6 +63,7 @@ "# For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", " # Your code here\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\")" @@ -103,6 +104,10 @@ "source": [ "def anagram_checker(word_a, word_b, is_case_sensitive):\n", " # Modify your existing code here\n", + " if is_case_sensitive == True:\n", + " return sorted(word_a) == sorted(word_b)\n", + " else:\n", + " return sorted(word_a.lower()) == sorted(word_b.lower())\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True"