Open
Conversation
…ing set would not work
dwz92
approved these changes
Sep 10, 2024
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 am adding code that fulfills the anagram_checker function requirements.
I am also checking that the code works fine with the example arguments.
What did you learn from the changes you have made?
I learned the if statements within the writing of the function. Overall, this helped me understand control flow better, and the differences between lists, tuples, sets, and their mutability/immutability.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
At first, I thought using sets would be a good idea. But I realized when doing the write-up that sets would make the string get rid of multiple values, so the function using sets would not catch multiples of the same letter in the word. Therefore, I changed my function to lists which would preserve the letters of the string that would be inputted in as arguments.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
In retrospect, in wouldn't have mattered so much because if both strings/words were truly anagrams of each other, making them into sets will have made them the same both sides of the equality operator (==). Regardless, I made them into lists and then reordered them by using .sort() then applied the equality operator to see if they were anagrams.
How were these changes tested?
These changes were tested with the example arguments. They tested out to be the expected results.
A reference to a related issue in your repository (if applicable)
n/a
Checklist