Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In football, there is a statistic for quarterbacks called the passer rating. To

ID: 3541886 • Letter: I

Question

In football, there is a statistic for quarterbacks called the passer rating. To

calculate the passer rating, you need five inputs: pass completions, pass

attempts, total passing yards, touchdowns, and interceptions. There are five

inputs needed for the calculations and five steps in the algorithm.

Write a program IN PYTHON that asks the user for five inputs:

i. Pass completions

ii. Pass attempts

iii. Total passing yards

iv. Touchdowns

v. Interceptions

Your five inputs should be used to calculate the following:

vi. C = ((completions per attempt * 100)

Explanation / Answer

Code



#!/usr/local/bin/python2.7

# coding: utf-8

passCompletions = raw_input('Enter the number of pass completions')

passAttempts = raw_input('Enter the number of pass attempts')

totalPassingYards = raw_input('Enter the value of total passing yards')

touchDowns = raw_input('Enter the number of touch downs')

interceptions = raw_input("Enter the count of interceptions")

C = (float(passCompletions) * 100 - 30) / 20

Y = (int(totalPassingYards) - 3)/4

T = int(touchDowns) * 20

I = 2.375 - (int(interceptions) * 25)

passerRating = (C+Y+T+I)/6*100

print '*****************************************'

print 'The Passer rating is '

print passerRating

print '*****************************************'