DML School of Technology
Menu

Getting going, Decisions

FizzBuzz

The task

Return "Fizz" if the number divides by 3, "Buzz" if it divides by 5, "FizzBuzz" if it divides by both, and otherwise the number itself as text.

Write a function called fizz_buzz.

Tests

CallExpectedYours
fizz_buzz(3) 'Fizz' not run
fizz_buzz(5) 'Buzz' not run
fizz_buzz(15) 'FizzBuzz' not run
fizz_buzz(7) '7' not run
fizz_buzz(30) 'FizzBuzz' not run
fizz_buzz(1) '1' not run

Next challenge · All challenges

solution.py

Tab indents. To leave the editor, press Escape, then Tab.

Output

Run prints what your code prints. Run the tests to check your function.