If you have not completed the "Timing Code Execution" and "Finding the Max" exercises from last week's lab, then please do so now that we have covered the material in lecture.

Sequential Search

Thanks to Dr. Alan McLeod for the content of this exercise.

Open the program you wrote for the "File I/O and Dictionaries" exercise last week and add two new functions findMin(...) and findMax(...). Each function must have two parameters: one for the weather data (a list of dictionaries) and one for the measurement (a string dictionary key). The functions must search through the weather data and return the dictionary with the maximum or minimum value for the given key.

Add calls to these functions inside main() to find record high and low temperatures, rainfalls and snowfalls. Here is a sample solution for the above.

Binary Search

Create a list of random integers using the randint(...) function from the random module and sort it using Python's sort() method for lists. Implement the binary search function from the lecture slides and call it using this list as an argument. Make sure your code catches any possible exceptions.

Now sort the list using sort(reverse=True). Change the binary search function to work with a list in reverse order; there is more than one way to do so.