Fizz Buzz Whiz
Level: Beginner 15–30 minConcepts: Algorithms
Solutions: C# | TypeScript | Python
Return “Fizz”, “Buzz” or “FizzBuzz”. For a given natural number greater zero return:
- “Fizz” if the number is divisible by 3
- “Buzz” if the number is divisible by 5
- “FizzBuzz” if the number is divisible by both 3 and 5
- The number if it is not divisible by both 3 and 5
Test Cases
| Input | Result |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | Fizz |
| 4 | 4 |
| 5 | Buzz |
| 6 | Fizz |
| 9 | Fizz |
| 10 | Buzz |
| 15 | FizzBuzz |
| 20 | Buzz |
| 30 | FizzBuzz |
| 75 | FizzBuzz |
Bonus
Add the following new rule, if a number is prime return Whiz. Only worry about numbers up to 100.
| Input | Result |
|---|---|
| 1 | 1 |
| 2 | Whiz |
| 3 | FizzWhiz |
| 4 | 4 |
| 5 | BuzzWhiz |
| 6 | Fizz |
| 7 | Whiz |
| 10 | Buzz |
| 15 | FizzBuzz |
| 30 | FizzBuzz |
Reference Walkthrough
Reference implementations in C#, TypeScript, and Python live at tddbuddy-reference-katas/fizz-buzz-whiz. This is the first F1 kata — a representative subset of eight scenarios for the base FizzBuzz rules, shared across all three languages, each a single pure function int → string. The Whiz (prime) bonus described in the Bonus section above is not implemented in the reference — base FizzBuzz is sufficient to demonstrate the shape.
- C# (.NET 8, xUnit, FluentAssertions 6.12.0) — walkthrough
- TypeScript (Node 20, Vitest 1.6, TS 5 strict) — walkthrough
- Python (3.11, pytest) — walkthrough
This kata ships in Agent Full-Bake mode at high gear: the algorithm is small enough to land as one commit per language, with a brief walkthrough noting there are no builders because the algorithm’s inputs and outputs are the domain. No aggregates to construct, no value types to introduce, no collaborators to inject — just say(n). See the repo’s Gears section for when high gear is the right call.
Related reading
- Katas Are Rehearsal, Not Performance
You don't practice TDD on production code. You practice on katas and bring the muscle memory to production. The gap between knowing TDD and doing TDD is reps. - The Instruction File Is Not the Discipline
Teams that want their agent to do TDD reach for the instruction file. The TDAD paper measured this directly: adding a 'do TDD' instruction raised regressions by nearly two-thirds. Contextual test discovery cut them by seventy percent. The instruction is theatre. The codebase's test surface is the discipline. - Spec-Driven Development Is the Prose-Spec Drift Trap, Reborn
Spec-Driven Development positions a separate prose document as the source of truth for what the system should do. Four generations of prose specs have drifted from the code, and SDD will drift too. Prose captures intent. Tests enforce claims. Production is the verdict.