Business

My three favorite python interview questions

I was recently interviewing some python developers for a job offer. And I thought I’d share my unorthodox methods for evaluating someone’s skill as a developer using Python.

That’s different from “how well do you know Python”. Because I really don’t care how well they can recite arcane details of the language.

Instead, I want to understand if they can balance getting things done with getting things right, in situations that are not entirely dissimilar to what I might actually be paying them to do.

So instead of having them draw some kind of bubbles on a whiteboard or something, here are a few things you could do:

1) Process CSV data

I tell them to bring their laptop to the interview and make sure it’s set up for Python development.

I’ll give you a CSV file of some kind of interesting data. Nutritional information for different foods, for example, something like that. And I’m going to ask you to write a program to ingest and answer questions about that data.

Starting with the simple: “What is the average value of the ‘calories’ column?”

So I know that they can at least open the file and suck up the data.

Then something a little more interesting, like, “Sort foods by their protein-to-calorie ratio.”

And so.

I don’t care if they use Pandas, or the csv module, or some library I’ve never heard of. I don’t care if they use PyCharm, Vim or Nano. Unless it’s something basic, I don’t even care if they search online during the interview to find out.

I only care that they CAN figure it out.

2) Talk JSON over HTTP

I wrote a small task list web service, which can GET, PUT and POST over the network. And I give you the address and a short document that fully specifies your API…

How to create new tasks; incomplete task list; mark tasks as done; and so.

And he walked them through writing a code that exercises it. Because in the modern world, we have to write a lot of code binding with web services like this.

If it turns out they’ve never done this kind of thing yet, maybe they’ve only had jobs up until now where it was never needed, for example, in a way, that’s even better.

Because I can give you a quick tutorial on using the “requests” module and see if you can use it right away to create simple API interactions.

And this allows me to test your ability to quickly learn a library and use it in real code… ANOTHER important skill in the modern world.

3) Test-Based Version Control

I will ask you to develop a simple library, using test driven development.

Emphasis on “simple.” I’m not going to ask you to implement a JIT compiler for a C-like language.

More like: generate entire sequences. Something a bit trivial, because I’m testing something else right now. And we don’t have all day to do the interview.

So I tell you the first requirement. And tell them to write code that meets that requirement, using test-driven development and version control.

(Again, I don’t care if they use unittest or pytest or nose; git or mercurial or fossil or whatever. If they can do it with one of these, they can quickly learn how to do it on the one I want.)

Once they’ve done that, I give them the new requirement. And they have to write new unit tests, perhaps by modifying some of the tests they just wrote, and then deploying the application code to make the tests pass.

And I repeat one or two more times.

This tells me a lot about how they develop the software, its strengths and its weaknesses.

There is more to the interview process than this. What I wrote above are just a few pieces that you could use in an interview.

And if you plan to go in for an interview soon, consider practicing with these questions beforehand. Just maybe, it will help you prepare to pass with flying colors.

Leave a Reply

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