commiting my first assignment for the python module, Evan Chan #1
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.
UofT-DSI | Python - Assignment 1
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
I have added code (python) to build a function to compare if any two give are anagrams
What did you learn from the changes you have made?
I learned how to use statements such as if, elif, and else, as well as the incorporation of logical operators
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
My initial approach was very inefficient, in that i attempted to match each index of the first string to be compared to every other possible indices of the second string. This would have result in too many lines of code and only limited the functionality of the anagram to specific string lengths. Instead, I found out about the sorted() function and took this approach instead!
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
The main challenge I faced was the ordering of which "conditions" to test first. Should i compare string lengths first and than sort, or should i compare it the other way around? I decided to go with the former approach, as if both of the strings are of different lengths, than there is no point in comparing constituent elements of the strings :)
How were these changes tested?
I executed each code by code block. When I ran into an error, i debugged it first. At the very end, to make sure that everything executed, I ran the entire code.
A reference to a related issue in your repository (if applicable)
N/A
Checklist