Skip to content

fix: handle whitespace correctly in word count - #47

Merged
codepiyusss merged 1 commit into
codepiyusss:mainfrom
Khushleen-Kaur:feature
Oct 13, 2026
Merged

codepiyusss merged 1 commit into
codepiyusss:mainfrom
Khushleen-Kaur:feature

Conversation

@Khushleen-Kaur

@Khushleen-Kaur Khushleen-Kaur commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the count_words() function to handle whitespace correctly.

  • Handle multiple spaces, tabs, and newlines between words.
  • Correctly return 0 for empty or whitespace-only input.
  • Remove the xfail markers from the related word-count tests.

Related issue

Closes #1

Checklist

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

@codepiyusss
codepiyusss merged commit 2c4e4c8 into codepiyusss:main Oct 13, 2026
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.

Bug: count_words counts extra spaces as words

2 participants