Open
Conversation
xindizhang
approved these changes
Dec 2, 2025
There was a problem hiding this comment.
Excellent work! Your code is clean and well-written and your PR description is clear. Great extra test cases. Assignment 1 is complete – no changes needed.
Just a couple minor suggestions for future improvement:
- In places like:
if(word_a != word_b):
return False
return True
You can simplify this by directly returning the boolean expression:
return word_a == word_b
This makes the code cleaner
- Very minor: No need to join the sorted strings unless you’re comparing strings instead of lists — but comparing lists directly is fine.
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)
Adding code for the two anagram_checker subroutines (one with an extra paramter for is_case_sensitive) for assignment_1.ipynb. I also added few extra test cases.
What did you learn from the changes you have made?
I learnt more about creating functions using python. I used the Docstring I learnt in class to add description about the function. This is the first time I am learning that we could create those convenient function descriptions. I also learnt that python use the word strip for trimming string, many other programming languages would use the word trim. I also learnt to use other string functions such as lower() for lowercase and len to check the length. The len function was different because it took the string as an argument and the lower() seems to be a method associated with the string. I also gained practise with sorted and the array function join. I am not sure how much more or less performant they are as compared to using loops and key-value pairs, but they definitely kept the code more concise and readable, as opposed to using loops.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
I was first thinking about using loops and key value pairs to look up each letter count. However, sorted and join helps to keep the code more concise and clean. I am not sure which technique is more efficient in terms of runtime and memory usage.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
At work I mostly use Perl. Python is a shift. There are some similarities, but there are also differences. I have to remember to keep the difference in mind. To overcome some of my challenges, I would google how to do 'x' in python, for example, how to trim a string in python. I was also not too sure how to confirm if my changes were correct, but the list of test case code snippets in the notebook helped a lot. I also added some extra. I think have an auto-grader for this assignment would also be really helpful to help us confirm if we are on the right track. It will definitely help with grading anxiety!
How were these changes tested?
I ran the code snippets that called the function and check to confirm if the output match the output stated in the comment.
A reference to a related issue in your repository (if applicable)
Checklist