In [ ]:
PasserRatingNFL = (a + b + c + d) / 6 * 100
In [6]:
def passer_rating(comps, atts, yds, tds, ints):
a = ((comps / atts) - .3) * 5
if a < 0:
a = 0
elif a > 2.375:
a = 2.375
else:
pass
b = ((yds / atts) - 3) * .25
if b < 0:
b = 0
elif b > 2.375:
b = 2.375
else:
pass
c = (tds / atts) * 20
if c < 0:
c = 0
elif c > 2.375:
c = 2.375
else:
pass
d = 2.375 - (ints / atts * 25)
if d < 0:
d = 0
elif d > 2.375:
d = 2.375
else:
pass
PasserRatingNFL = ((a + b + c + d) / 6) * 100
return PasserRatingNFL
passer_rating(comps, atts, yds, tds, ints):
In [7]:
russell = passer_rating(15.0, 22.0, 268.0, 3.0, 0.0)
print 'Russell\'s passer rating was', round(russell, 1)
In [8]:
cam = passer_rating(23.0,36.0, 246.0, 2.0, 2.0)
print 'Cam\'s passer rating was', round(cam, 1)
In [4]:
def passer_rat(comps, atts, yds, tds, ints):
l = [((comps / atts) - .3) * 5]
l.append(((yds / atts) - 3) * .25)
l.append((tds / atts) * 20)
l.append(2.375 - (ints / atts * 25))
m = []
for a in l:
if a < 0:
a = 0
m.append(a)
elif a > 2.375:
a = 2.375
m.append(a)
else:
m.append(a)
PasserRating = ((m[0] + m[1] + m[2] + m[3]) / 6) * 100
return PasserRating
In [5]:
russ = passer_rat(15.0, 22.0, 268.0, 3.0, 0.0)
print 'Russell\'s passer rating was', round(russ, 1)
In [5]:
In [ ]: