avatar Bite 46. You are a programmer! Code Fizz Buzz

Here is a beginner Bite to write Fizz Buzz:

Fizz buzz is a group word game for children to teach them about division. Players take turns to count incrementally, replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz".
For example, a typical round of fizz buzz would start as follows:
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ..

Complete the fizzbuzz function below, it should take a number and return the right str or int.

If you want to write this TDD-style, consider doing Code Challenge 45 instead.

See also Coding Horror's Why Can't Programmers.. Program? for a fun read.

Login and get coding
go back Beginner level
Bitecoin 2X

778 out of 797 users completed this Bite.
Will you be Pythonista #779 to crack this Bite?
Resolution time: ~23 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 1.86 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help