Skip to content

Commit 80ea201

Browse files
committed
updating comments in functions
1 parent 38472a9 commit 80ea201

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

02_activities/assignments/assignment_1.ipynb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
{
5858
"cell_type": "code",
59-
"execution_count": 2,
59+
"execution_count": null,
6060
"metadata": {},
6161
"outputs": [
6262
{
@@ -73,7 +73,10 @@
7373
"source": [
7474
"# This is a function, which we will learn more about next week. For testing purposes, we will write our code in the function\n",
7575
"def anagram_checker(word_a, word_b):\n",
76-
" return set(word_a.lower()) == set(word_b.lower())\n",
76+
" # inputs: word_a and word_b are both strings\n",
77+
" # Compares the character set of word_a with that of word_b, using .lower() to make the comparison case-insensitive \n",
78+
" # output: boolean. returns True if the strings are anagrams (case-insensitive), False otherwise.\n",
79+
" return set(word_a.lower()) == set(word_b.lower()) \n",
7780
"\n",
7881
"# Run your code to check using the words below:\n",
7982
"anagram_checker(\"Silent\", \"listen\")"
@@ -146,6 +149,12 @@
146149
],
147150
"source": [
148151
"def anagram_checker(word_a, word_b, is_case_sensitive):\n",
152+
" # inputs: word_a and word_b are both strings, is_case_sensitive is boolean\n",
153+
" # Check that the character set in word_a is the same as word_b, \n",
154+
" # using .lower() method to make the comparison case-insensitive if is_case_sensitive is False,\n",
155+
" # otherwise compare the sets as-is.\n",
156+
" # output: boolean. returns True if the strings are anagrams, False otherwise.\n",
157+
"\n",
149158
" return set(word_a.lower() if not is_case_sensitive else word_a) == set(word_b.lower() if not is_case_sensitive else word_b.lower())\n",
150159
"\n",
151160
"# Run your code to check using the words below:\n",

0 commit comments

Comments
 (0)