Open
Conversation
kelichiu
reviewed
Feb 17, 2025
| " if (sorted(word_a.lower())) == (sorted(word_b.lower())):\n", | ||
| " return False\n", | ||
| " else:\n", | ||
| " return True\n", |
There was a problem hiding this comment.
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)
kelichiu
reviewed
Feb 17, 2025
| "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", |
There was a problem hiding this comment.
The if else statement is not necessary, and can be consolidate to one line:
return (sorted(word_a.lower()) == (sorted(word_b.lower())
kelichiu
suggested changes
Feb 17, 2025
kelichiu
left a comment
There was a problem hiding this comment.
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.
PassCode ExecutionAll code cells execute without errors. Code Quality
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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