Fizz Buzz Whiz

Level: Beginner 15–30 min

Concepts: 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

InputResult
11
22
3Fizz
44
5Buzz
6Fizz
9Fizz
10Buzz
15FizzBuzz
20Buzz
30FizzBuzz
75FizzBuzz

Bonus

Add the following new rule, if a number is prime return Whiz. Only worry about numbers up to 100.

InputResult
11
2Whiz
3FizzWhiz
44
5BuzzWhiz
6Fizz
7Whiz
10Buzz
15FizzBuzz
30FizzBuzz

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.

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.


  • 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.
  • Cohesion Is the Coverage of the Agent Era
    Agent-generated codebases pass every structural-modularity metric while fragmenting the domain concept the team was trying to encode. Coverage measured whether a line ran. Mutation score measured whether an assertion pinned behavior. Cohesion is the next axis, and it measures whether the codebase's concepts are traversable end-to-end.
  • Test Deletion Is a Privileged Operation
    The cheapest way for an agent to make a failing test pass is to delete it. That is logical for the agent and catastrophic for the codebase. Tests are append-only by default. Deletion needs a human author, a separate commit, and a separate review.