For a pole vaulter, it is very important to begin the approach run at the best possible starting mark. This is affected by numerous factors and requires fine-tuning in practice. But there is a guideline that will help a beginning vaulter start at approximately the right location for the so-called "three-step approach," based on the vaulter's body height.

This guideline was taught to me in feet and inches, but due to the international nature of Codewars, I am creating this kata to use metric units instead.

You are given the following two guidelines to begin with:
(1) A vaulter with a height of 1.52 meters should start at 9.45 meters on the runway.
(2) A vaulter with a height of 1.83 meters should start at 10.67 meters on the runway.

You will receive a vaulter's height in meters (which will always lie in a range between a minimum of 1.22 meters and a maximum of 2.13 meters). Your job is to return the best starting mark in meters, rounded to two decimal places.

Hint: Based on the two guidelines given above, you will want to account for the change in starting mark per change in body height. This involves a linear relationship. But there is also a constant offset involved. If you can determine the rate of change described above, you should be able to determine that constant offset.

Difficulty: introductory

Starter code:

def starting_mark(height):
	

Solutions:
def starting_mark(height):
    return round(9.45 + (10.67 - 9.45) / (1.83 - 1.52) * (height - 1.52), 2)

# The linear relashionship is obvious taking a couple a informations (L1,H1) and (L2,H2)
# One gets 3.9354838709677433 = (H1-H2)/(L1-L2) and beta = H1-3.9354838709677433*H1

def starting_mark(height):
    return round(3.9354838709677433*height+3.4680645161290293,2)

A = (10.67-9.45) / (1.83-1.52)
B = 9.45 - A*1.52

def starting_mark(height):
    return round(A * height + B, 2)

def starting_mark(h):
    return round((3.9356133666666666666666*h)+3.46809,2)

def starting_mark(height):
    slope = 3.93548387
    intercept = 3.46806452
    return round(height*slope + intercept,2)


def starting_mark(height):
    #define gradient for our equation
    m = (10.67 - 9.45) / (1.83 - 1.52)
    #define our y-intercept for our equation
    c = 10.67 - (m*1.83)
    #plug height into our formula and return value
    return round(m*height+c,2)

starting_mark = lambda h, s=3.93548, c=3.46807: round(c+s*h, 2)

def starting_mark(height):
    return round( 1.22 / 0.31 * (height + 0.8812), 2 )

import numpy as np
from sklearn.linear_model import LinearRegression

def starting_mark(h):
    
    X, Y = np.array([1.52, 1.83]).reshape(-1, 1), np.array([9.45, 10.67])
    model = LinearRegression().fit(X, Y)
    theta0 = model.intercept_
    theta1 = model.coef_
    
    return round(theta0.item() +theta1.item() *h, 2)



((x1, y1), (x2, y2)) = ((1.52, 9.45), (1.83, 10.67))

def starting_mark(height):
    return round((height - x1) / (x2 - x1) * (y2 - y1) + y1, 2)

def starting_mark(height):
    return round(height * 3.9354839 + 3.4680645, 2)

def starting_mark(height):
    if(height < 1.52):
        change_height = 1.52-height
        change_runway = (1.22/float(0.31))*change_height
        return round((9.45-change_runway),2)
    else:
        change_height = height - 1.52
        change_runway = (1.22/float(0.31))*change_height
        return round((9.45 + change_runway),2)
    #your code here


def starting_mark(height):
    return round((122 / 31) * height + (9.45 - 1.52 * (122 / 31)), 2)

import math
def starting_mark(h):
    x=(10.67-9.45)/(1.83-1.52)
    return round((x*h+10.67-x*1.83),2)

def starting_mark(height):
    return round(3.4681 + 3.93548 * height, 2)

def starting_mark(height):
    slp = (10.67 - 9.45) / (1.83 - 1.52)
    cst = 9.45 - slp * 1.52
    return round( slp * height + cst, 2 )

m, c = 3.93548, 3.46806
def starting_mark(height):
    return round(m*height + c,2)

def starting_mark(height):
    m = 1.2200000000000006 / 0.31000000000000005
    print(height)
    return round(m*(height-1.52) + 9.45, 2)

def starting_mark(height):
    answers = {
        1.21:8.23,
        1.22:8.27,
        1.23:8.31,
        1.24:8.35,
        1.25:8.39,
        1.26:8.43,
        1.27:8.47,
        1.28:8.51,
        1.29:8.54,
        1.3:8.58,
        1.31:8.62,
        1.32:8.66,
        1.33:8.7,
        1.34:8.74,
        1.35:8.78,
        1.36:8.82,
        1.37:8.86,
        1.38:8.90,
        1.39:8.94,
        1.4:8.98,
        1.41:9.02,
        1.42:9.06,
        1.43:9.1,
        1.44:9.14,
        1.45:9.17,
        1.46:9.21,
        1.47:9.25,
        1.48:9.29,
        1.49:9.33,
        1.5:9.37,
        1.51:9.41,
        1.52:9.45,
        1.53:9.49,
        1.54:9.53,
        1.55:9.57,
        1.56:9.60,
        1.57:9.65,
        1.58:9.69,
        1.59:9.73,
        1.6:9.76,
        1.61:9.8,
        1.62:9.84,
        1.63:9.88,
        1.64:9.92,
        1.65:9.96,
        1.66:10,
        1.67:10.04,
        1.68:10.08,
        1.69:10.12,
        1.7:10.16,
        1.71:10.2,
        1.72:10.24,
        1.73:10.28,
        1.74:10.32,
        1.75:10.36,
        1.76:10.39,
        1.77:10.43,
        1.78:10.47,
        1.79:10.51,
        1.8:10.55,
        1.81:10.59,
        1.82:10.63,
        1.83:10.67,
        1.84:10.71,
        1.85:10.75,
        1.86:10.79,
        1.87:10.83,
        1.88:10.87,
        1.89:10.91,
        1.9:10.95,
        1.91:10.98,
        1.92:11.03,
        1.93:11.06,
        1.94:11.1,
        1.95:11.14,
        1.96:11.18,
        1.97:11.22,
        1.98:11.26,
        1.99:11.3,
        2:11.34,
        2.01:11.38,
        2.02:11.42,
        2.03:11.46,
        2.04:11.5,
        2.05:11.54,
        2.06:11.58,
        2.07:11.61,
        2.08:11.65,
        2.09:11.69,
        2.1:11.73,
        2.11:11.77,
        2.12:11.81,
        2.13:11.85
    }
    
    return answers.get(height, None)


def starting_mark(height):
    x1, y1 = 1.52, 9.45
    x2, y2 = 1.83, 10.67
    slope = (y2-y1)/(x2-x1)
    c = y2 - slope * x2
    return round(height * slope + c,2)

def starting_mark(height):
    x = 1.22/.31
    f = 9.45 - 1.52*x
    return round(height*x + f, 2)

def starting_mark(height):
    # y = kx+d
    k = (10.67-9.45)/(1.83- 1.52)
    d = 9.45-k*1.52 
    return round(k*height+d,2)

def starting_mark(height):
    a = (10.67 - 9.45) / (1.83 - 1.52)
    b = 10.67 - (1.22 / 0.31) * 1.83
    return round(height * a + b, 2)

def starting_mark(height):
    return round(height*122/31+189/20-38*122/775, 2)

def starting_mark(height):
    return round(height*3.935483870967742 + 3.468064516129031,2)

def starting_mark(height):
    # y = ax + c
    a = (9.45 - 10.67) / (1.52 - 1.83)
    c = 9.45 - a * 1.52
    return round(a * height + c, 2) 

def starting_mark(height):
    return round(3.935483871 * height + 3.468064516, 2)

def starting_mark(height):
    return round(height * (1.22 / 0.31) + (9.45 - (1.22 / 0.31) * 1.52), 2)

def starting_mark(height):
    HEIGHT_1 = 1.52
    HEIGHT_2 = 1.83
    START_MARK_1 = 9.45
    START_MARK_2 = 10.67
    
    # y = k*x + m
    k = (START_MARK_2 - START_MARK_1) / (HEIGHT_2 - HEIGHT_1)
    m = START_MARK_1 - k * HEIGHT_1 
    y = k * height + m
    
    return round(y, 2)

def starting_mark(height):
    slope = (9.45 - 10.67) / (1.52 - 1.83)
    intercept = 9.45 - (1.52 * slope)
    return round(slope * height + intercept, 2)

def f(x):
    return 3.93548 * x + 3.468072

def starting_mark(height):
    return round(f(height), 2)

def starting_mark(height):
#    return round(height * 3.937 +3.4655,2)
    return round((height /0.0254*3.937+136.43)*0.0254,2)

import math
def starting_mark(height):
    if height == 1.22: 
        return 8.27;
    elif height == 2.13:
        return 11.85;
    else: 
        return round((8.27 + 0.0393444 * ((height - 1.22) * 100)),2) 



def starting_mark(height):
    return round(3.935483870967742 * height + 3.468064516129031, 2)

def starting_mark(height):
    return round(3.9355*height + 3.468065,2)

def starting_mark(height):
    return round(8.27+(height-1.22)*3.9340659, 2)

def starting_mark(h):
    return round((1.22)/(.31)*h +3.4680, 2)

def starting_mark(height):
    return round(10.67-(10.67-9.45)/(1.83-1.52)*(1.83-height), 2)

def starting_mark(height):
    #return round(height*3.9354838709677433 + 3.4680645161290293,2)
    return round(height*(10.67-9.45)/(1.83-1.52) + 3.4680645161290293 ,2)

k = 3.935483870967742
b = 3.468064516129031

def starting_mark(height):
    return round(k * height + b, 2)

def starting_mark(height):
    return round(3.935483870967741 * height + 3.468064516129033,2)

def starting_mark(height):
    
  m = (10.67 - 9.45) / (1.83 - 1.52)
  return round((((m * height + 10.67 - m * 1.83) * 100) / 100),2)

def starting_mark(height):
    """ y = mx+b, always has, always will."""
    slope = (10.67 - 9.45)/(1.83-1.52) #(d-d0)/(h - h0)
    return round(slope*(-1.83 + height) + 10.67,2)


def starting_mark(height):
    #your code here
    #slope of line = (y2 - y1) / (x2 - x1)
    slope = (10.67 - 9.45) / (1.83 - 1.52)
    #substitute slope and one set of x,y to find the y-intercept C
    #y = mx + c -> c = y - mx
    c = 10.67 - (slope * 1.83)
    #for the given x, return mx + c, rounded off to 2 decimals
    return round(slope * height + c, 2)


def starting_mark(height):
    return round((10.67 - 9.45) / (1.83-1.52) * height + 10.67 - 1.83 * ((10.67 - 9.45) / (1.83-1.52)), 2)

def starting_mark(height):

    height_1 = 1.52
    height_2 = 1.83
    start_1 = 9.45
    start_2 = 10.67
    
    v_constant = (start_2 - start_1) / (height_2 - height_1)
    
    start = start_1 + v_constant * (height - height_1)
    
    return round(start,2)

def starting_mark(height):

    height_1 = 1.52
    height_2 = 1.83
    start_1 = 9.45
    start_2 = 10.67
    
    v_constant = (start_2 - start_1) / (height_2 - height_1)
    
    if height < height_1:
        start = start_1 - v_constant * (height_1 - height)
    elif height < height_2:
        start = start_2 - v_constant * (height_2 - height)
    else:
        start = start_2 + v_constant * (height - height_2)
    
    return round(start,2)

# Line equation calculated by Wolfram|Alpha

def starting_mark(height):
    return round(3.93548 * height + 3.46806, 2)

def starting_mark(height):
    if height <= 1.52:
        res = 9.45 - ((1.52 - height) * (10.67 - 9.45) / (1.83 - 1.52))
    elif 1.52 < height <= 1.83:
        res = 10.67 - ((1.83 - height) * (10.67 - 9.45) / (1.83 - 1.52))
    else:
        res = 10.67 + ((height - 1.83) * (10.67 - 9.45) / (1.83 - 1.52))
    return round(res, 2)

def starting_mark(height):
    return round(((3.9354*height) + 3.4680)+.0001,2)

import math

def starting_mark(height):
    
    d = (height-1.22)*3.934+8.27
    
    return round(d,2)
    


def starting_mark(height):
    gradient = (10.67-9.45)/(1.83-1.52)
    return round(9.45+gradient*(height-1.52),2)

def starting_mark(h):
    return round((3.935484*h+3.468065),2)

def starting_mark(height):
    #your code here
    return round(9.45 + (10.67 - 9.45) / (1.83 - 1.52) * (height - 1.52), 2)
    
    
    
    
# def starting_mark(height):
#     return round(9.45 + (10.67 - 9.45) / (1.83 - 1.52) * (height - 1.52), 2)


starting_mark=lambda n:round(n*3.935+3.469,2)

x = (9.45-10.67)/(1.52-1.83)
a = 9.45-1.52*x
def starting_mark(h):
    return round(a+x*h,2)

def starting_mark(height):
    return round(height*3.9340659340659343 + 3.4704395604395604,2)

def starting_mark(height):
    return round(((height - (1.52-(0.31/1.22)*9.45))/(0.31/1.22)),2)

def starting_mark(height):
    return round(3.9344 * height + 3.47, 2)

def starting_mark(height):
    slope = 1.22 / 0.31
    offset = 9.45 - slope*1.52
    result = round(slope * height + offset, 2)
    return result

import math
def starting_mark(height):
    k = (10.67 - 9.45) / (1.83 - 1.52)
    b = 9.45 - k * 1.52
    y = k * height + b
    return round(y, 2)

def starting_mark(height: float) -> float:
    return round((1.22 / 0.31) * (height - 1.52) + 9.45, 2)


def starting_mark(height):
  return round(((((10.67 - 9.45) / (1.83 - 1.52) * height + 10.67 - (10.67 - 9.45) / (1.83 - 1.52) * 1.83) * 100) / 100),2)

def starting_mark(height):
    #your code here
    return round(height*1.22/0.31+9.45-1.22*1.52/0.31, 2)

def starting_mark(height):
    return round(3.9355*height+3.4680, 2)

R = (10.67 - 9.45) / (1.83 - 1.52)

def starting_mark(height):
    return round(height * R + 3.468, 2)

x=3.468064516129032
def starting_mark(height):
    return round(height*(3.935483870967742)+x,2)

def starting_mark(height):
    return round(height*3.935483870967742+3.4680645161290323, 2)

def starting_mark(height):
    gradient = (10.67-9.45)/(1.83-1.52)
    c = 10.67 - (gradient * 1.83)
    return round(gradient*height+c,2)


def starting_mark(height):
    return round(8.27+(height-1.22)*3.935,2)

def starting_mark(height):
    c=(1.83*9.45-10.67*1.52)/(1.83-1.52)
    x=(9.45-c)/1.52
    return round(x*height+c,2)


def starting_mark(height):
    #Oof
    return round(9.45 + (10.67 - 9.45) / (1.83 - 1.52) * (height - 1.52), 2)

def starting_mark(height):
    return round((1.22 * height / 0.31) + 3.468, 2)

def starting_mark(height):
    return round((height-1.22)*3.9354838709677419354838709677419+8.27,2)

def starting_mark(height):
    return round(1.22/0.31 * height + (1.0751/0.31),2)

def starting_mark(height):
    #your code here
    m=3.9355
    c=3.4680
    return round(m*height+c,2)

def starting_mark(height):
    
    m = (10.67-9.45)/(1.83-1.52)
    c = 10.67 - m*1.83
    
    return round(height*m+c,2)


starting_mark=lambda h: round(9.45+(10.67-9.45)/(1.83-1.52)*(h-1.52), 2)

def starting_mark(height):
    #your code here
    # 9.45-1.52 =7.93    10.67-1.83= 8.84
    # 9.45 = m(1.52) + b // 10.67 = m(1.83) + b
    # 1.22 = 0.31m  ==> 3.94 = m and b = 3.46
    m = 1.22/0.31
    b = 10.67 - (1.83*m)
    return float("{:.2f}".format(round(m*height+b,2)))


def starting_mark(height):

    h1 = 1.52
    d1 = 9.45
    
    h2 = 1.83
    d2 = 10.67
    
    v = (d2 - d1) / (h2 - h1)
    
    return round(d2 - v * (h2 - height),2)

def starting_mark(height):
    l = 3.93548387
    l1 = 3.46806452
    return round(height*l + l1,2)

def starting_mark(height):
    return float(format(8.27 + (height-1.22)*3.58/0.91, '.2f'))

def starting_mark(height):
    return round(3.470421640055+height*3.934119,2)


def starting_mark(height):
    slope = (10.67-9.45)/(1.83-1.52)
    if height < 1.52:
        return round(9.45-(1.52-height)*slope, 2)
    elif height < 1.83:
        return round(10.67-(1.83-height)*slope, 2)
    else:
        return round(10.67+(height-1.83)*slope, 2)

def starting_mark(height):
    slope = (10.67 - 9.45) / (1.83 - 1.52)
    intercept = 9.45 - 1.52 * slope
    return round(slope * height + intercept, 2)

import math
def starting_mark(height):
    constant = (10.67 -9.45)/(1.83-1.52)
    return round((constant*height +10.67 -constant*1.83),2)

def starting_mark(height):
    return round((3.934065934065934 * height) + 3.47043956043956, 2)

def starting_mark(height):
    # 10.67 = 1.83*a + b
    #  9.45 = 1.52*a + b
    # ------------------ -
    #  1.22 = 0.31*a
    # a = 3.93548
    a = 1.22 / 0.31
    b = 9.45-1.52*a
    return round(a*height + b,2)

def starting_mark(height):
    print (height)
    return round(height*3.9355+3.468,2)

def starting_mark(height):
    return round((1.22 * height + 1.0751) / .31, 2)

def starting_mark(height):
    a=(10.67-9.45)/(1.83-1.52)
    return round((9.45+a*(height-1.52)),2)#your code here

def starting_mark(height):
    return round(height*3.935483870967742 + 3.468064516129032, 2)

def starting_mark(height):
    return round(height*1.22/.31 + 3.468065,2)

from decimal import Decimal


def starting_mark(height):

#     if height == 1.22:
#         return 8.27
#     elif height == 2.13:
#         return 11.85
    
    number = Decimal("0.03935483870967741935483870968")
    start = Decimal("8.27")
    height = Decimal(height)
    min_height = Decimal("1.22")
    
    form = (height - min_height) * 100 * number + start
    form = form.quantize(Decimal("1.00"))
    form = float(form)
    return form

def starting_mark(height):
    x=3.935484
    y=3.468065
    
    return round(height*x+y,2)

def starting_mark(height):
    m = (10.67 - 9.45) / (1.83 - 1.52)
    c = 10.67 - m * 1.83
    return round(m * height + c, 2)

def starting_mark(h):
    return round(starting_mark.k*h+starting_mark.d, 2)
starting_mark.eg = [(1.52,9.45),(1.83,10.67)]
starting_mark.k = (starting_mark.eg[1][1]-starting_mark.eg[0][1])/(starting_mark.eg[1][0]-starting_mark.eg[0][0])
starting_mark.d = starting_mark.eg[0][1]-starting_mark.k*starting_mark.eg[0][0]

def starting_mark(height):
    return round((height - 1.22) * 3.58 / 0.91 + 8.27, 2)

def starting_mark(height):
    d = (10.67-9.45)/(1.83-1.52)
    return round(10.67 - d*(1.83-height), 2)


def starting_mark(height):
    return round((9.45 + (height - 1.52) * (10.67 - 9.45)/(1.83 - 1.52)) * 100.0) / 100.0