FizzBuzz

So I was reading a programming blog from a few years ago that was asking, why can’t programmers.. program?. The article set a challenge to

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Now technically the answer to the puzzle uses nothing more than Nat 5 constructs, so can you code a Python solution? Share it here if you get a nice one

(hint after the jump)

The key to this program, like every other is understanding the problem. How about if I move the program description about a little to help?

Write a program that for the numbers 1 to 100.

  • For numbers which are multiples of both three and five print “FizzBuzz”.
  • For multiples of three print “Fizz”.
  • For the multiples of five print “Buzz”.
  • For everything else print the number.

Leave a Reply

Your email address will not be published. Required fields are marked *