A toy token counter
Define a function that splits on spaces. Label it a toy, not a real tokenizer.
Assert that 'red fox' returns 2.
Pass an empty string and expect 0, not a crash.
Sources and go deeper
- Python 3 tutorial vendor last checked 2026-10
- Python.org community community last checked 2026-10
- Python (programming language) — Wikipedia wikipedia last checked 2026-10