do you fail at FizzBuzz? simple prog test

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 13 01:05:00 EDT 2008


En Mon, 12 May 2008 14:42:30 -0300, bruno.desthuilliers at gmail.com  
<bruno.desthuilliers at gmail.com> escribió:

> On 12 mai, 09:00, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>> En Sat, 10 May 2008 22:12:37 -0300, globalrev <skanem... at yahoo.se>  
>> escribió:
>>
>> > "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".
>>
>> (We used this question last year - some people gave a sensible answer  
>> in less than 5 minutes,  but others did not even know how to start)
>
> I just can't believe someone applying for a programmer position cannot
> provide a sensible anwser in 5 or less minutes.

For some people, "program" == "form with buttons", excluding all else.  
Maybe it's an education problem - "programming in XXX" courses usually  
focus on the XXX language itself, assuming (sometimes wrongly) that the  
student has a "general programming" background. Worse, I've seen a book on  
VB.net (and I think it's not the only one) that is more focused on "how to  
use Visual Studio" than teaching the language itself, so it's not  
surprising that some people may consider "what's the shortcut to [do some  
visual task]" an important "programming skill".

So I think the FizzBuzz problem is a good test to filter out candidates  
based on (lack of) practical programming skills. But I don't like that it  
is still slightly math-biased (our version said: if multiple of 7 OR ends  
in 7 -> replace with the word "Domingo"). I probably would not reject an  
answer like this:

for n in range(1,100):
   if multiple_of_7(n) or ends_with_7(n): print "Domingo"
   else: print n

even if multiple_of_7 or ends_with_7 are incorrect or have some comment  
like "I don't remember how to check this". The overall structure is OK,  
the guy has decomposed the problem into two smaller subproblems, now it's  
time to ask a domain expert about the details... :)
But the poor guy doesn't know that; he's under a lot of stress, nervous,  
only has a few minutes remaining and surely thinks "I *have* to write this  
in full else I won't get the job!"
I would like to write a similar problem without this non-programming  
distracting issues (that is, a problem simple enough to be answered in a  
few minutes, that requires only programming skills to be solved, and  
leaving out any domain-specific knowledge).

-- 
Gabriel Genellina




More information about the Python-list mailing list