You just got done with your set at the gym, and you are wondering how much weight you could lift if you did a single repetition. Thankfully, a few scholars have devised formulas for this purpose (from [Wikipedia](https://en.wikipedia.org/wiki/One-repetition_maximum)) :


### Epley


### McGlothin


### Lombardi


Your function will receive a weight `w` and a number of repetitions `r` and must return your projected one repetition maximum. Since you are not sure which formula to use and you are feeling confident, your function will return the largest value from the three formulas shown above, rounded to the nearest integer. However, if the number of repetitions passed in is `1` (i.e., it is already a one rep max), your function must return `w`. Also, if the number of repetitions passed in is `0` (i.e., no repetitions were completed), your function must return `0`.

Difficulty: introductory

Starter code:

def calculate_1RM(w, r):
	

Solutions:
def calculate_1RM(w, r):
    if r == 0: return 0
    if r == 1: return w
    
    return round(max([
      w * (1 + r / 30),                 # Epley
      100 * w / (101.3 - 2.67123 * r),  # McGlothin
      w * r**0.10                       # Lombardi
      ]))

def calculate_1RM(w, r):
    return (
        w if r == 1 else
        0 if r == 0 else
        round(max(
            w * (1 + r/30),
            100 * w / (101.3 - 2.67123*r),
            w * r**0.10,
        ))
    )

epley     = lambda w,r: w * (1+r/30)
mcGlothin = lambda w,r: 100*w / (101.3 - 2.67123*r)
lombardi  = lambda w,r: w * r**0.10

def calculate_1RM(w, r):
    return r and (w if r == 1 else round(max(epley(w,r), mcGlothin(w,r), lombardi(w,r))))

calculate_1RM=lambda w,r:[[round(max(w*(1+(r/30)),100*w/(101.3-(2.67123*r)),w*r**0.10)),0][r==0],w][r==1]

def calculate_1RM(w, r):
    if r <= 1:
        return r*w
    return int(round(max( (w*(1+r/30)), ((100*w)/(101.3-2.67123*r)), (w*r**0.10) )))

ORM = [('Epley', lambda w,r: w * (1 + r/30)),
       ('McGlothin', lambda w,r: 100 * w / (101.3 - 2.67123 * r)),
       ('Lombardi', lambda w,r: w * r**0.1)]

def calculate_1RM(w, r):
    if r == 0: return 0
    elif r == 1: return w
    else: return round(max(func(w, r) for _, func in ORM))

def calculate_1RM(w, r):
    if r in (0, 1):
        return (0, w)[r]
    epley = w * (1 + r / 30)
    mcg = 100 * w / (101.3 - 2.67123 * r)
    lomb = w * r ** .1
    return round(max((epley, mcg, lomb)))


def calculate_1RM(w, r):
    if r == 1:
      return w
    if r == 0:
      return 0
    return round(max(w*(1+r/30),100*w/(101.3-2.67123*r),w*(r**0.1)))

def calculate_1RM(w, r):
    if r == 0:
        return 0
    if r == 1:
        return w
    return max(int(round(w*(1+r/30))),int(round(100*w/(101.3-2.67123*r))),int(round(w*r**(1/10))))

def calculate_1RM(w, r):
    return [w if r == 1 else r if r == 0 else round(max([w * (1 + r / 30), 100 * w / (101.3 - 2.67123 * r), w * r**0.1]))][0]