Passer ratings are the generally accepted standard for evaluating NFL quarterbacks.
I knew a rating of 100 is pretty good, but never knew what makes up the rating.
So out of curiosity I took a look at the wikipedia page and had an idea or my first kata: https://en.wikipedia.org/wiki/Passer_rating

## Formula

There are four parts to the NFL formula:
```python
A = ((Completions / Attempts) - .3) * 5
B = ((Yards / Attempts) - 3) * .25
C = (Touchdowns / Attempt) * 20
D = 2.375 - ((Interceptions / Attempts) * 25)
```
However, if the result of any calculation is greater than `2.375`, it is set to `2.375`. If the result is a negative number, it is set to zero.

Finally the passer rating is: `((A + B + C + D) / 6) * 100`

Return the rating rounded to the nearest tenth.

## Example

Last year Tom Brady had 432 attempts, 3554 yards, 291 completions, 28 touchdowns, and 2 interceptions.
His passer rating was 112.2

Happy coding!

Difficulty: introductory

Starter code:

def passer_rating(att, yds, comp, td, ints):
	

Solutions:
def passer_rating(att, yds, comp, td, ints):
    limit = lambda x: min(max(x, 0), 2.375)
    
    att = float(att)    # for python 2 compatibility
    
    A = ((comp / att) - .3) * 5
    B = ((yds / att) - 3) * .25
    C = (td / att) * 20
    D = 2.375 - ((ints / att) * 25)
    
    A, B, C, D = map(limit, (A, B, C, D))
    
    return round( (A + B + C + D) / 6 * 100, 1 )

def passer_rating(attempts, yards, completions, touchdowns, interceptions):
    a = (completions / attempts - .3) * 5
    b = (yards / attempts - 3) * .25
    c = (touchdowns / attempts) * 20
    d = 2.375 - (interceptions / attempts * 25)
    a, b, c, d = (max(0, min(x, 2.375)) for x in (a, b, c, d))
    return round((a + b + c + d) / 6 * 100, 1)

def passer_rating(att, yds, comp, td, ints):
    A = ((comp / att) - .3) * 5
    B = ((yds / att) - 3) * .25
    C = (td / att) * 20
    D = 2.375 - ((ints / att) * 25)
    
    lst = [2.375 if element > 2.375 
                 else 0 if element < 0
                 else element for element in (A, B, C, D)]
                 
    passer_rating = sum(lst) / 6 * 100
    return round(passer_rating, 1)

def passer_rating(att, yds, comp, td, ints):
    cap = lambda x: max(0, min(x, 2.375))
    a = cap(((comp / att) - 0.3) * 5)
    b = cap(((yds / att) - 3) * 0.25)
    c = cap((td / att) * 20)
    d = cap(2.375 - ((ints /att) * 25))
    return round((a + b + c + d) / 6 * 100, 1)

def limit(n):
    return max(0, min(2.375, n))


def passer_rating(a, y, c, t, i):
    Y = limit((y / a - 3) * 0.25)
    C = limit((c / a - 0.3) * 5)
    T = limit(20 * t / a)
    I = limit(2.375 - 25 * i / a)
    return round(100 * (Y + C + T + I) / 6, 1)

def passer_rating(att, yds, comp, td, ints):
    a = ((comp / att) - 0.3) * 5
    b = ((yds / att) - 3) * 0.25
    c = (td / att) * 20
    d = 2.375 - ((ints / att) * 25)
    return round(sum(max(0, min(x, 2.375)) for x in [a, b, c, d]) * 50 / 3, 1)

def passer_rating(att, yds, comp, td, ints):
   
    def bording(score):
        if score < 0:
            return 0
        if score > 2.375:
            return 2.375
        return score
        
    a = bording(((comp / att) - 0.3) * 5)
    b = bording(((yds / att) - 3) * 0.25)
    c = bording((td /att) * 20)
    d = bording(2.375 - ((ints / att) * 25))
    
    return round(((a + b + c + d) / 6) * 100, 1)

def passer_rating(att, yds, comp, td, ints):
    A = max(min(2.375, ((comp / att) - .3) * 5), 0)
    B = max(min(2.375, ((yds / att) - 3) * .25), 0)
    C = max(min(2.375, (td / att) * 20), 0)
    D = max(min(2.375, 2.375 - ((ints / att) * 25)), 0)
    return round(((A + B + C + D) / 6) * 100, 1)


def passer_rating(att, yds, comp, td, ints):
    return round( sum(map(lambda n: min(2.375, max(0, n)),
                          [(comp/att-0.3)*5, (yds/att-3)*.25, td/att*20, 2.375-ints/att*25])) / 6 * 100, 1)

def passer_rating(att, yds, comp, td, ints):
    a = ((comp/att)-0.3)*5 ; a = min(a, 2.375) ; a = max(a, 0)
    b = ((yds/att)-3)*0.25 ; b = min(b, 2.375) ; b = max(b, 0)
    c = (td/att)*20 ; c = min(c, 2.375) ; c = max(c, 0)
    d = 2.375 - ((ints/att)*25) ; d = min(d, 2.375) ; d = max(d, 0)
    
    return round(((a+b+c+d)/6)*100,1)