FizzBuzz Challenge
Beginner
15 XP
You're trying this as a guest: your result shows here but isn't saved.
Sign in
The classic programming interview question!
Write a program that prints the numbers from 1 to 20, but:
- For multiples of 3, print Fizz instead of the number.
- For multiples of 5, print Buzz instead of the number.
- For multiples of both 3 and 5, print FizzBuzz.
Each value should be on its own line. This teaches conditional logic, the modulo operator, and the importance of checking conditions in the right order.
To pass
- Should produce correct FizzBuzz output for 1-20
- Should print FizzBuzz for multiples of both 3 and 5
- Should print Fizz for multiples of 3
- Should print Buzz for multiples of 5
Need a hint?
- Use the modulo operator (%) to check divisibility — 15 % 3 == 0 is True.
- Check the 'both' case (% 15) FIRST, before checking 3 or 5 individually.
- The order matters! if -> elif -> elif -> else.