Skip to content

Decisions · warm-up

FizzBuzz, one number

Write fizzbuzz(n): "FizzBuzz" if n divides by 3 and by 5, "Fizz" if only by 3, "Buzz" if only by 5, and otherwise the number as a string.

Run adds print(fizzbuzz(15)) after your code, to try it.

Stuck on the idea rather than the code? The Combining conditions lesson walks through it.