Re: Why Can’t Programmers.. Program?

Jeff Atwood made a post on his blog today about a simple test used to screen prospective programmers looking for a job. The reason: many people who claim to be programmers fail to solve the simplest of problems. The test:

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”.

Just for kicks, I knocked out the program in Python in a few short seconds to see if I could do it. :)

# FizzBuzz test.
for x in range(1,101):
	if( (float(x%3)==0) & (float(x%5)==0) ):
		print 'FizzBizz'
	elif( float(x%3)==0 ):
		print 'Fizz'
	elif( float(x%5)==0 ):
		print 'Bizz'
	else:
		print x

This entry was posted in Code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>