Python Coder Test

January 17th, 2009

Since Net Communities have their new developer, I can post the coder test I wrote to find a replacement. The test was not meant to be particularly challenging, and we only requested that developers do one out of the three problems. Most developers did all three--presumably in an effort to impress--but nobody got all three correct, first time around. That was probably my fault, because the third problem had a subtle issue that is easy to overlook.

I'll quote the problems here, including typos. Occasionally the way I phrased things was slightly ambiguous, but I didn't penalize if the candidate misunderstood a requirement due to my use of language.

1. Write a script that takes a file containing a number of tags words (one per line) and sorts them by the number of times they occur in the file (descending order), but exclude words that only occur once. Ignore the case of the words, and filter out any puncutation characters. The output should be the word, followed by a space and the number of times it occurs in the file.

Example input:








Example output:

microsoft 3

apple 2

This is something I would expect any programmer to be able to solve in any language. What I was looking for is simplicity in the solution. If a developer solves a simple problem like this with complex code, then he* would probably solve a complex program with unmaintainable code. And although efficiency was not a requirement for any of the problems, I was disappointed by the number of developers that didn't know when to use a dictionary / set over a list. Many candidates failed on this problem because they didn't fulfill all the requirements, not because the code was buggy but because the a requirement was simply ignored. This left me in a bit of a quandary, because I suspected that most of the candidates could have done it adequately if prompted--but then shouldn't a developer pay attention to details?

2. Write a script that removes blank paragraphs from a piece of html. A blank paragraph should be considered to be a <p> </p> tag containing only white space.

I was looking for a regular expression here. Even if a developer hasn't had a great deal of experience with regular expressions, he should be able to recognize that this is a situation where an R.E. would come in handy. One developer parsed the HTML to find blank paragraphs, which was hard to fault because it did work--but I tend to prefer the simplest solution that works, and a handful of lines is generally preferably to several pages of code.

3. Write a decorator that stores the result of a function call and returns the cached version in subsequent calls (with the same parameters) for 5 minutes, or ten times -- whichever comes first.

This was the one that everyone failed. The main issue was that to do it properly you need to create an immutable key out of the parameters to the function to be cached. But that was only the final hurdle, many candidates failed on simpler issues. In fact, many 'solutions' didn't actually run at all! This surprised me--if you have plenty of time to write the code and there is potentially a job riding on it, don't you test your solution?

Although nobody got that last problem correct, we did interview some good developers with a mix of skills and abilities. Most of whom were very passionate about working Django, and passion is a good thing in any field.

Being on the other side of an interview was an interesting experience for me, I hope I wasn't too much of a jerk! Thanks to all who applied.

If anyone wants to post a solution to any of the problems, they are more than welcome--but I'm afraid the job has been filled.

* I hate to type 'he or she', please assume thats what I mean.


New Blog Design

January 16th, 2009

I've been working on a blog system in Django lately. I know, I know. Everyone is working on a blog system in Django. I'll discuss how I justify writing a new blog system when there is Wordpress and some excellent existing blog apps for Django. For now, I would like your opinion on the basic design. Here's a screenshot. Be honest, but if you think it sucks, you may make me cry -- I've been working on it for weeks!

New Blog Design

Ubuntu, you've done it again

January 14th, 2009

I may have spoken too soon regarding no having internet access. I just plugged in my Sony Ericsson phone via USB, switch it to 'phone mode' and Ubuntu instantly recognised the phone as a modem.

I did have mobile internet working on an older release of Ubuntu, but not without scouring the internet and typing magic incantations in to the command line. I love it when computers 'just work'!

I'm tempted to try it again in Vista to compare, but I really should get back to the packing.


I've moved to Oxford

January 14th, 2009

As of tomorrow (Thursday 15 Jan) I'll be living in Oxford. Let me know if you need my new address. My landline number will change, but you can still get me on my mobile.

I wont have Internet access at home for a while, so I apologise if I can't answer emails until then.

Now back to the packing!

Search for Posts
© 2008 Will McGugan.

A technoblog blog, design by Will McGugan