On the main Python list there is a thread entitled, "Beginners and
experts (Batchelder blog post)", and Stefan Ram mentioned:  "... The
fact that programmers can't program is known since the invention of
the "FizzBuzz" programmer test. ..."

I vaguely recall seeing some reference to "FizzBuzz" in my past
Internet wanderings, but did not recall any specifics, so did a search
for it.  My first hit was http://wiki.c2.com/?FizzBuzzTest  So I went
there and was informed:

<quote>
The "Fizz-Buzz test" is an interview question designed to help filter
out the 99.5% of programming job candidates who can't seem to program
their way out of a wet paper bag. The text of the programming
assignment is as follows:"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”."
</quote>

I did *not* read any further, opened up gVim, and in less than 5 minutes had:

for i in range(1, 101):
    if i % 15 == 0:
        print('FizzBuzz')
    elif i % 3 == 0:
        print('Fizz')
    elif i % 5 == 0:
        print('Buzz')
    else:
        print(i)

If I understand the problem correctly, this gives the desired result.
I would have had this in < 30 seconds if I did not stop at each stage
and verified I was getting my expected result.  I don't claim to be a
*real* programmer and am definitely no where approaching a
professional programmer, but this question seems ridiculously easy!
Surely I am missing something obvious and substantial?  Of course, I
could have done tests, comments, prettied up the output, etc., but the
essential problem seems to be trivial for *anyone* exposed to the if -
elif - else structure and is aware of the modulus operator.  What am I
missing???  How can anyone in any programming language not get this
question right?

-- 
boB
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to