Python Exercises – FizzBuzz

FizzBuzz is a classic programming exercise, which is used in many job interviews.  Basically, there are many people who like to call themselves programmers, who can’t actually program their way out of a paper bag.  So to start an interview for a programming job, you might be asked to whip out a quick FizzBuzz solution, on a whiteboard or on a computer.

FizzBuzz is a weeding-out exercise. If you can’t do it, it shows that you know nothing meaningful about programming.  If you can do it, nobody will be impressed, but you will probably get to participate in the rest of the interview.

FizzBuzz:

  • List the numbers from 1 to 1000.  If the number is a multiple of 3, print the word “Fizz”.  If the number is a multiple of 5, print the word “Buzz”.  If the number is a multiple of both 3 and 5, print the word “FizzBuzz”.
  • Extensions:
    • Prompt the user for the Fizz number and the Buzz number, and then respond appropriately.
Advertisements

About ehmatthes

Teacher, hacker, new dad, outdoor guy
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s