Activity : Who should I pick for my team?


Introduction

I bet that at least some of you play Fantasty Football or follow your favorite team. Have you ever gotten in to an argument about who is the better quarterback - Tom Brady or Ben Rothlisberger? [Well, this year that's a no brainer - it's Tom Brady. But, still, Go Steelers!]

One of the ways we could answer this question without just personal opinion is through the use of the Quarterback Passer Rating. The QB Passer Rating is a standard statistic in football that can be used to compare two QBs. 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:
    • Completion portion (A)
      • You calculate "completions per attempt" and then times 100 - 30, all divided by 20
    • Yards portion (B)
      • You calculate "yards per attempt" - 3, all divided by 4
    • Touchdown portion (C)
      • You calculate "touchdowns per attempt" times 20
    • Interceptions portion (D)
      • You calculate "interceptions per attempt" multiply this by 25 and then SUBTRACT FROM 2.375
      • That is, 2.375 - (IPA*25)
  2. Adjust each of the sub stats:
    • If any of the sub stats (A, B, C, or D) is above 2.375 you should set those stats to equal 2.375
    • If any of the sub stats is below 0 you should set those stats to equal 0
  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 their passer rating.

 

[Note, that can be a little bit confusing to read in text. You can look up "Passer Rating" on wikipedia. They structure their formulas a bit differently but it is the same result.]

 

FINALLY, in general you can use this number to predict how good of a year the QB is having (or had).

Score Rating
85 or lower Bad
Above 85 but 90 or lower Mediocre
Above 90 but 95 or lower Good
Above 95 Great

 

For this assignment we will use these files of data from the 2020 season:

 


Program Guide

For this assignment you should create the following functions in a file called quarterbacks.py

In this assignment you will make three functions. The first two are smaller, helper functions that will be used by the third function.

Create a function called: passerRating()

This function should:

 

Create a function called: ratingCategory()

This function should:

 

Create a function called: addColumns()

This function should:

 


Testing Your Code

 

  1. Go to the AutoLab Homepage for the course
    1. https://hypnos.cs.uni.edu/courses/CSED1320-F21/assessments
    2. Log in if necessary
  2. For each of the assignments listed above, find their submission link under the "Practice" heading
  3. Upload the corresponding python file for that assignment.
  4. When the "handin history" page comes up you will need to refresh the page until a score of either 0 or 1 is shown with your assignment.
  5. Click on the 0/1 score to get feedback.
  6. Read the information carefully if you received a score of 0 and figure out what you need to do to fix the problem.
    • Ask for help from me or other students if you don't understand an error message.
  7. Resubmit until the program earns a 1.