Essential Phone Screen Python Interview Question

The fact is that there are far too many developers with allegedly extensive Python programming experience and education on their resumes who are terrible at some of the most primitive Python interview programming skills.

These days, for our Python Software Developer positions, we now routinely ask during phone screening the following

To prepare for our interview please implement the following code:

For each integer in the range 1 to 100 (inclusive)
Print a line such that:
If it is evenly divisible by 3  print "Fizz"
If it is evenly divisible by 5  print "Buzz"
If it is evenly divisible by 15 print "FizzBuzz"
Otherwise: print the number itself.

Be prepared to talk about testing methodology, refactoring, code maintenance or design considerations

We have done this about a hundred times over the last couple of years. So far no one has gotten a perfect score on it and only one developer has gotten a correct bit of code on the first attempt.

Here’s a working solution:

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

That’s by no means perfect. But it exactly implements the specified functionality. Less than one in ten people who have been scheduled for phone screening as developers does this well at this problem.

Read More Post