The Buzz about Fizz

Gregg writes about the FizzBuzz furor, and links to the original post, which states the hypothetical problem.

All caught up? Good. I’ll leave Gregg’s point to Gregg…

The thing is, the original post brings up a valid point. The FizzBuzz test thingy–while admittedly arbitrary–is a shit or get off the pot situation. The solution is logically easy, therefore the resultant code should be easy to write.


def fizzbuzz():
    a = 1
    while a <= 100:
        b, c = a % 3, a % 5
        if b and c: print a
        if not b and c: print 'fizz'
        if b and not c: print 'buzz'
        if not b and not c: print 'fizzbuzz'
        a += 1

It may not be the most elegant way of doing it in Python, but do I get the job?

My point here is not to show off my hardcore Python coding skillz (I don’t have any of those), but if you’re interviewing programmers, it might be a good idea to use a FizzBuzz-esque litmus test at the very beginning of the interview; it could save you a lot of time.

One thought on “The Buzz about Fizz

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s