Skip to content

UofT-DSI | Python - Assignment 1#1

Open
renrihui8415 wants to merge 3 commits intomainfrom
assignment-1
Open

UofT-DSI | Python - Assignment 1#1
renrihui8415 wants to merge 3 commits intomainfrom
assignment-1

Conversation

@renrihui8415
Copy link
Copy Markdown
Owner

@renrihui8415 renrihui8415 commented May 1, 2024

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

  • Adding code for Python Assignment-1, specifically for Anagram Checker. The code was extended to handle case sensitivity, remove the spaces in the strings, and use a FOR loop to check for anagrams within arrays of words.

What did you learn from the changes you have made?

  • From the changes, I learned about string manipulation, handling case sensitivity, removing the spaces in the strings, and implementing algorithms to check for anagrams.

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

  • Yes. Another approach that crossed my mind was utilizing sorting or counting characters in the strings to create the anagram checker.
  • a) Sort the characters in each string (eg. alphabetically), and compare them to see if they are identical;
  • b) Count the occurrences of each character in the strings, and check if the counts match in each string.

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

  • I didn't encounter significant challenges during the process.

How were these changes tested?

  • The changes were tested by using Jupyter Notebook and running the cells to observe if the results returned as expected. This involved inputting various combinations of words and checking if the function correctly identified whether they were anagrams or not, taking into considerations the case sensitivity option.

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

  • N/A

@mentions of the person or team responsible for reviewing proposed changes (At least 2 people)

Checklist

  • [✓ ] I can confirm that my changes are working as intended

Copy link
Copy Markdown

@juliagallucci juliagallucci left a comment

Choose a reason for hiding this comment

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

Good! Code is well executed though could be more concise.
For example, part a could be written in 2 lines
def anagram_checker(word_a, word_b):
return sorted(word_a.lower()) == sorted(word_b.lower())

@renrihui8415
Copy link
Copy Markdown
Owner Author

Good! Code is well executed though could be more concise. For example, part a could be written in 2 lines def anagram_checker(word_a, word_b): return sorted(word_a.lower()) == sorted(word_b.lower())

Thank you, Julia.

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