• April 12, 2021

My 3 Favorite Python Interview Questions

Recently, I interviewed 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 is 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 doing things right, in situations that are not entirely different than what I’m actually paying them to do.

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

1) CSV data processing

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 with some kind of interesting information. Nutrition information for different foods, for example, something like that. And I’ll ask you to write a program to ingest and answer questions about that data.

Starting with the simple: “What is the average value in the” calories “column?”

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

Then something a little more interesting, like: “Rank foods by 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 or Vim or Nano. Unless it’s something basic, I don’t even care if they look online during the interview to find out.

I only care that they CAN figure it out.

2) Speak JSON over HTTP

I wrote a little to-do 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; list incomplete tasks; mark tasks as done; and so.

And I guide you through writing a code that exercises it. Because in the modern world, we have to write a lot of sticky code with web services like this.

If it turns out that they’ve never done this kind of thing yet, maybe they’ve only had jobs so far where it was never required, for example, somehow, that’s even better.

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

And this allows me to assess 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-based 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 where I want.)

Once you have done that, I give you the new requirement. And they have to write new unit tests, maybe modifying some of the tests they just wrote and then implementing the application code for the tests to pass.

And I repeat one or two more times.

This tells me a lot about how they develop software, its strengths and 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 to an interview soon, consider practicing with these questions first. 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 *