1 There are no easy methods of learning difficult things; the method is to close your door, give out that you are not at home, and work.
1.1 Lab Assignment
1.2 Validation
1.3 Structure
1.4 How To Complete This Lab
1.5 Submission Procedure
1.6 Version : 2014/ 02/ 14

CS 110X Feb 12 2014 : LAB FOUR

If you can make an LED blink on an Arduino board, you can do anything.
George Heineman

1 There are no easy methods of learning difficult things; the method is to close your door, give out that you are not at home, and work.

1.1 Lab Assignment

In this fourth lab, you are going to get some experience with CSV files and with nested loops. Doing so will prepare you for the HW5 homework assignment to be assigned on Feb 13 2014.

First you must download a Python file lab4.py and store it in a folder on your lab computer.

Then make sure to download the following file and save it to the exact same folder (and keep the name the same); you must do so, otherwise you won’t be able to read this data set for input. In this lab, this file is known as the DataSet.

Write a Python module that allows the user to print all players whose BA and HR are greater than or equal to n standard deviation above the respective averages.

The basic idea is to compute two threshold values, one for home runs totals (HR) and one for batting average (BA).

The threshold is equal to the Average + n*StandardDeviaion

The user is able to enter in the number n which represents how far above average

1.2 Validation

Once done, your program will look like this:

>>> lab4() Welcome to The Baseball Reporting System There are 1600 records available How many sigmas to use for threshold [1-4]? 2 The following players exceed average + 2 sigma On both HomeRuns and Batting Average Searching for HR >= 32.0638528121 and BA >= 0.327661295493 Miguel Cabrera 44 0.33 Miguel Cabrera 38 0.328 Manny Ramirez 37 0.332 Albert Pujols 37 0.357 Carlos Gonzalez 34 0.336 Ryan Braun 33 0.332 6 players identified

1.3 Structure

I have started you off with a template that contains a number of functions:

Your task is to complete the remaining functions in the code. Be sure to review the existing functions to see how everything should fit together. Don’t change the functions that should be left alone.

1.4 How To Complete This Lab

You must fill in code in several functions that have already been documented for you:

When you are done, you will run the lab4() program and demonstrate that you achieved the results as shown earlier.

1.5 Submission Procedure

You must make sure you submit your lab via turnin.

1.6 Version : 2014/02/14

(c) 2014, George Heineman