Skip to content

Add anagram command (closes #96) - #193

Merged
codepiyusss merged 1 commit into
codepiyusss:mainfrom
amanpreet-09:feat/anagram-command
Dec 5, 2026
Merged

codepiyusss merged 1 commit into
codepiyusss:mainfrom
amanpreet-09:feat/anagram-command

Conversation

@amanpreet-09

Copy link
Copy Markdown

What does this PR do?

Adds a new anagram command that checks whether two words or phrases are anagrams.

  • is_anagram(first, second) in fixit/textutils.py lowercases both texts, removes spaces, sorts the letters and compares them. It returns the result and doesn't print anything.
  • fixit anagram FIRST SECOND in fixit/cli.py prints True or False.
  • New tests in tests/test_anagram.py cover normal words, mixed case, phrases with spaces, different lengths, repeated letters, empty strings and the CLI output.
  • One line added to CHANGELOG.md.

Examples:
fixit anagram listen silent -> True
fixit anagram Dormitory "dirty room" -> True
fixit anagram hello world -> False

Related issue

Closes #96

Checklist

  • I commented on the issue first and was assigned
  • I removed the xfail marker (if fixing a bug) (not a bug fix)
  • I added or updated tests
  • pytest passes locally (203 passed)
  • This PR only addresses one issue

Add is_anagram() to fixit/textutils.py and a new `fixit anagram FIRST SECOND`
command that prints True or False. Case and spaces are ignored, so
"Dormitory" and "dirty room" match.

Tests cover normal words, mixed case, phrases with spaces, different
lengths, repeated letters, empty strings and the CLI output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codepiyusss
codepiyusss merged commit c331b64 into codepiyusss:main Dec 5, 2026
2 checks passed
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.

Feature: add an anagram checker command

2 participants