Skip to content

Conversation

@cvasoff
Copy link
Owner

@cvasoff cvasoff commented Oct 19, 2025

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

Create a Python function to compare two strings using a Boolean equivalence comparator to determine whether the strings contain the same alphabetic characters by passing two (supplied) arguments into the anagram_checker function.

What did you learn from the changes you have made?

In developing the code at an earlier stage, I printed the strings after sorting them to see how Python was sorting them. I then added a sorted.() key optional key str.casefold parameter to sort the strings alphabetically, regardless of case (i.e., upper case letters no longer indexed at the front of the string value). I realized I could use this key function to compare strings where the checker is required to be case sensitive. I also had to work on aligning my code within the function correctly so that it would run without throwing an error.

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

No, I didn't have time.

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

I am still working on navigating between git bash and GitHub and VS code, to better understand what I'm actually doing. I relied on internet searches of the sorted.() function and Boolean value comparisons to generate ideas for my coding, as well as the course slides and supplied links (e.g., https://docs.python.org/3.13/library/index.html).

How were these changes tested?

I relied on my printed strings to understand where to make changes. For example: # Print the two sorted string lists
print('String one: ', sorted_worda). I ran my code, compared the outputs with the referenced outputs in the assignment questions, and continued modifying my code until the outputs were correct.

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

Checklist

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

Copy link

@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, though code could be more concise. For example, part B could be as simple as:

if not is_case_sensitive:
    word_a = word_a.lower()
    word_b = word_b.lower()
    return(sorted(word_a) == sorted(word_b))   

else:
    return(sorted(word_a) == sorted(word_b))   

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.

3 participants