One Line Python Fizz Buzz! by Neal Horner | July 10, 2015

Fizz Buzz is a classic substitution game, where players count incrementally, replacing numbers divisible by 3 with 'Fizz' and numbers divisible by 5 with 'Buzz'.

Example: 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16...

The game is often used to test people's knowledge of a given programming language because it incorporates many key concepts, like loops, division and logic statements. In college, one of my professors gave me a modified version of Fizz Buzz.

Prompt

Write a program that lists numbers from 100 to 0. Replace numbers divisible by 3 with 'Fizz' and number divisible by 5 with 'Buzz'. Numbers that are both divisible by 3 and 5 should be replaced with 'FizzBuzz'. When the program reaches 0 print 'Blast off!!!'.

Standard Python

One Line Python

Fizz Buzz with other languages:

For more examples from other lanuages check out rosettacode.org's article on Fizz Buzz

Javascript

Lua

PHP

Swift