Loading...
Loading...
Loading...
Given a number, print FizzBuzz if it is divisible by both 3 and 5, Fizz if it is divisible only by 3, Buzz if it is divisible only by 5, and the number itself otherwise.
FizzBuzz, Fizz, Buzz, or the number.Example 1
Input
9
Output
Fizz
Example 2
Input
10
Output
Buzz
Try the problem first. Open one hint at a time.
A number divisible by both 3 and 5 must be tested before the single checks.
Use n % 3 == 0 and n % 5 == 0 first, then the single checks in an elif ladder.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor