Programmers who can’t program
Jeff Atwood at Coding Horror asks Why Can’t Programmers Program? and passes along what is considered to be an absolute minimum test for programming competency:
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”.
I’m happy to say I was able to write a working solution in Python in less than four minutes. I’m absolutely shocked that someone would apply for a programming job without being able to do the same in a similar amount of time.
I mean, I’m certainly no professional programmer and I only mess with Python as a hobby… but even I could do write code for FizzBuzz.
Read Jeff’s whole post and check out the other articles he links. Amazing.
Update: For those who asked, here’s my solution:
#!/usr/bin/env python
for number in range(1,101):
if (number % 3) == 0 and (number % 5) == 0:
print "FizzBuzz"
elif (number % 3) == 0:
print "Fizz"
elif (number % 5) == 0:
print "Buzz"
else:
print number
March 1st, 2007 at 12:10 am
Indeed… I was the IT manager at my last job, and hiring ‘programmers’ was the hardest thing ever. I started hiring guys who had an interest so I could teach them myself.
At my current employer, we’ve been looking for a /good/ programmer for some time now, and it seems like an impossible task. Weirdness.
March 2nd, 2007 at 11:51 am
Hi im a spanish python junkie, i have not studied programming career at all, and i know some graduated ones that dont know some basics of programming xD, maybe is the devotion of the computer addicteds, i want to say that this blog is great and paste a snippet of code i made to makeFizzOrBuzz xD, a little bored in my work, keep the good work i like to read your entries
makeFizzOrBuzz = lambda x: ["","FizzBuzz"][x%3%5==0 and x>=(3*5)] or ["","Fizz"][x%3==0] or ["","Buzz"][x%5==0] or x;[ makeFizzOrBuzz(num) for num in range(1,101)]
i know a little sloppy snippet of code xD, and the ternary/array hack is ugly yeah xD but i wanted to make a version of a snippet pasted by one ruby addicted