CS21 Lab9: lab08 module documentation

 
$ python
>>> import lab08
>>> help(lab08)

NAME
    lab08

DESCRIPTION
    Sample solution for lab 08
    Author: A.Danner
    Date: 11 November 2009
    You may use this solution or your own solution for lab 09
    These solutions may only be used for the purposed of completed lab 09 and
    should not be publicly shared

FUNCTIONS
    citySearch(ls, city, state)
        Search a list of zip code entries for a specific city, state pair
        using linear search
           ls: list of zip info entries
           city: a city (string)
	   state: a two letter state abbreviation (upper case string)         
           return: list index of matching zip entry or -1 if not found
        citySearch uses linear search, so ls does not need to be sorted

    getValidZip(ziplist)
        Repeatedly prompt the user to enter a valid zipcode that has
        an entry in the list of all zipcodes, ziplist
           ziplist: A list of zipcode entries sorted by zip code
           return: A single zipcode entry for a valid location in the form
             [zip, lat, long, city, county, state, pop] (list)

    readZips(fname)
        Read a file of comma separate zipcode entries entries
        and return a list of zipcode info.
           fname: file name (string) of zipcode file
              file must have format
              zip,lat,long,city,county,state,population
           return: a list of zipcode info lists
              each item in the list has the following format
              [zip, lat, long, city, county, state, population]
              lat and long should be floats
              population should be and integer
              all other fields including zip should be strings

    selectSort(ls, idx)
        Sort a list of items, where each item is itself a list. The
        list should be sorted using the entry in position idx in each list
        item
         ls: a list of list items
         idx: the index of each list item to sort on
         return: nothing, but modifies the list 'in place'

    swap(ls, i, j)
        Swap the item in position i in the list ls with the item at position j
        return: nothing, but ls should be modified

    zipSearch(ls, zipcode)
        Search a list ls sorted by ZIPcode for a specific zip
           ls: list of zip info lists
           zipcode: a zipcode (string)
           return: list index of matching zip entry or -1 if not found