Programming Assignment #10

Analyzing the Quarterbacks in the NFL

Due Date : Friday, December 1st


Introduction

This assignment is a good way to pull together lots of the ideas we have used this semester so far.  To complete the assignment you will need to be able to work with:

Wow, that's a lot of ideas!!!!

Actually, this assignment isn't that bad in the end, but it is a lot to THINK about as you get started. 


Customer Request

You are contacted by Jacques Strap, who is the statistician for the NFL.  He wants to hire you to write some code to save him from performing a bunch of tedious calculations.

 

Background (Repeated from PA8)

In football there is a statistic for quarterbacks called the "passer rating."  While this only evaluates their abilities in the passing portion of the game (it doesn't take into account their ability to run, their ability to win, their ability to not fumble, etc.) it is often used as one way to analyze two quarterbacks and compare their abilities as a passer.

To calculate the passer rating you need five pieces of information:

To calculate the passing rating used in the NFL you:

  1. Calculate four sub stats:

     

  2. Adjust each of the sub stats:

     

  3. Calculate the passing rating by taking the sum of all four adjusted values, dividing by 6, then multiplying by 100

This final result is the passer rating.

 

Furthermore, in general you can use this number to predict how good of a year the QB was having.  Scores at 85 or worse mean the player was having a BAD year.  Scores above 85 are MEDIOCRE.  Scores above 90 are GOOD, and scores above 95 are GREAT.

 

To give you some numbers to work with, here are some stats through this week of the 2017 NFL football season

Name Attempts Completions Yards TD Interceptions Rating Prediction
Drew Brees

248

175 1951 11 4 101.7 Great
Matt Ryan 232 153 1844 9 6 92.3 Good
Eli Manning 260 167 1600 10 5 86.1 Mediocre
Ben Roethlisberger 275 168 2062 10 9 82.7 Bad
Fake Player 365 312 312 312 51 79.2 Bad

NEW Requirements

Jacques wants is a program that will:

  1. Be in a file called pa10.py
  2. Be in a function called compareQBs()
  3. When this function is run it should ipen the data file containing QB statistics from the 2013 season (I downloaded this from ESPN).
  4. For each Quarterback listed it should calculate their passer rating given the formula above.
  5. and their overall evaluation (great, good, mediocre, bad)
  6. Write a file called "qb_passer_ratings.csv" which contains each :
    1. QB's name
    2. team
    3. passer rating
    4. the evaluation of their season (great, good, mediocre, bad)

 

Suggestions

  1. Begin by ignoring file input.  Start your program with five appropriately named variables and set them to the values of one of the QBs in the table above.  Work through the math of the rating and make sure you get the listed result.  (This should be easy since this is mostly PA8).
  2. Wrap part one in a loop which is being fed data from the data file.  At this stage, just print results to the screen
  3. Finally, work in the code to write to an output file.

Final Submission

To upload your homework for grading, log on to the homework submission system at:

Follow the directions on the system to select the appropriate course and assignment and submit