CS21 Lab 8: Searching Data

Due Saturday night, April 1

As always, run update21, to create the cs21/labs/08 directory. Then cd into your cs21/labs/08 directory and create the program for lab 8 in this directory

Goals
Overview

This week's lab involves climate data for different countries. The file /usr/local/doc/climatedata.csv contains data from the CAIT Climate Data Explorer. Here are the first few lines from climatedata.csv:

Afghanistan|30682500|19731.34|0|15.21|44.42
Albania|2896652|12542.47|2319|11.84|7.95
Algeria|38186135|176324.90|47580|91.71|186.84
Angola|23448202|96261.43|15356|160.32|270.19
Antigua & Barbuda|89985|1155.65|0|0.40|1.11
Argentina|42538304|457639.09|80594|303.46|431.64

Each line contains data for a different country. The lines in the file are in alphabetical order based on the name of the country. Here's a handy chart for the position and meaning of each piece of data:

  1. Name -- name of country
  2. Population -- population of country (as of 2013)
  3. GDP -- country's GDP in US Dollars
  4. EnergyUse -- country's energy use in Thousand tonnes oil equivalent (ktoe)
  5. GHG1990 -- greenhouse gas emissions in 1990 (MtCO2e, Including Land-Use Change and Forestry)
  6. GHG2013 -- greenhouse gas emissions in 2013 (MtCO2e, Including Land-Use Change and Forestry)

Your job this week is to write a program (ghg.py) that reads in the climate data and displays the following information:

To get the information required above, you will (obviously) have to search through the climate data. For many of the searches, since the data is only sorted alphabetically by country, you will have to use a linear search. For the last one (search for data about a specific country) you can/should use a binary search.

Requirements and tips

Here are the specifications for this program and a few helpful "tips". Make sure your program meets all of these specifications.

Answer the Questionnaire; Run handin21

Once you are confident that your program works, fill out the questionnaire in README-08.txt.

Then run handin21 a final time to make sure we have access to the most recent versions of the files required for this lab.