Word count is off by one when text ends with a space

Offen
#1 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@accesswatch arbeitet bereits daran.

Seit 08.11.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

bug

What happened

word_count("hello world ") returns 3. There are only two words.

What I expected

  1. A space at the end of the text shouldn't count as a word.

How to see it

  1. Run python -c "import sys; sys.path.insert(0, 'src'); import tally; print(tally.word_count('hello world '))"
  2. It prints 3.

The same happens with two spaces between words.

Vorherrschende Sprache
Python
Sterne
1
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Community-Access/quill-github-practice

Alle Issues in Community-Access/quill-github-practice

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.