Deviopath › Python

FizzBuzz for One Number

Easy · Loops

FizzBuzz is a classic: for numbers divisible by 3 say "Fizz", for numbers divisible by 5 say "Buzz", and for numbers divisible by both say "FizzBuzz". Check the "both" case first, or it will never be reached.

Write a function fizzbuzz(n) that returns "Fizz", "Buzz", "FizzBuzz", or otherwise the number as a string (str(n)).

Next: Square Every Number