No description or website provided.
Python Shell


This is a challenge I did for a job I applied for. The task was to construct a script which accepts a name and range of years as parameters and returns the arithmetic mean of the rank of male children within the top 1,000 results for that date range.

The script needed to use web scraping to retrieve the names, and cache the details locally so it would work even if the website went offline.

How to run

The easiest way to run this is to use vagrant:

  1. Clone the git repository
  2. Run vagrant up to start the Vagrant box
  3. Type vagrant ssh
  4. In the vagrant ssh window, type cd /vagrant
  5. Type python <name> <start_year> <end_year> for example python Billy 1992 2001

If you want to run directly on linux:

  1. Clone the repo
  2. Run pip install -r requirements.txt to install the pip requirements (lxml)
  3. Type python <name> <start_year> <end_year> for example python Billy 1992 2001


Once you run a command once the results will be cached in a sqlite database for offline mode and faster access in the future.