Skip to content

I modified assignment_1.ipynb file#1

Open
mariatocora wants to merge 2 commits intomainfrom
assignment-1
Open

I modified assignment_1.ipynb file#1
mariatocora wants to merge 2 commits intomainfrom
assignment-1

Conversation

@mariatocora
Copy link
Copy Markdown
Owner

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

I modified the file assignment_1.ipynb where I used different methods to build an anagram checker

What did you learn from the changes you have made?

I practiced creating functions using different methods, conditionals, and a boolean.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

First, I created strings with anagrams and started comparing them while changing their cases. Then, after feeling confident, I wrote the function and used different examples to confirm the function was working.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

I was confused about using a boolean option in the function, but I checked the slides and attended office hours for clarity.

How were these changes tested?

I used the examples provided in the assignment and other anagrams to test the function (e.g., Stop/Spot, Lemon/Melon) was working

A reference to a related issue in your repository (if applicable)

NA

Checklist

  • I can confirm that my changes are working as intended

" if (sorted(word_a.lower())) == (sorted(word_b.lower())):\n",
" return False\n",
" else:\n",
" return True\n",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is_case_sensitive is set to False, instead of returning Trueright away, we need to compare the strings case insensitively. Right now, your code is returning True without other conditions when is_case_sensitive is set to False.
To verify, execute the following. The following code returns True, which is incorrect:
anagram_checker("Silent", "sight", False)

"def anagram_checker(word_a, word_b): # Define a function with the def keyword\n",
" if (sorted(word_a.lower())) == (sorted(word_b.lower())): # sorted(), makes a new list with sorted values; lower() method returns the lowercased strings\n",
" return True # Return statement\n",
" else: \n",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if else statement is not necessary, and can be consolidate to one line:
return (sorted(word_a.lower()) == (sorted(word_b.lower())

Copy link
Copy Markdown

@kelichiu kelichiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete

Code Execution

Part 2 code cell executes with errors.

Code Quality

  • Code is well-organized, concise.
  • Codes includes necessary comments for clarity.
  • Great use of variable names.

@kelichiu
Copy link
Copy Markdown

Pass

Code Execution

All code cells execute without errors.

Code Quality

  • Code is well-organized, concise.
  • Codes includes necessary comments for clarity.
  • Great use of variable names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants