All caught up? Good. I’ll leave Gregg’s point to Gregg…
The thing is, the original codinghorror.com 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.