Sue and Kathy were doing their algebra homework. They were asked to write the equation of the line that

passes through the points (–3, 4) and (6, 10). Sue wrote y - 4 = 2/3(x + 3) and kathy wrote y = 2/3x + 6. Write a recursive function to represent this same relationship.

1 answer

def find_slope(p1, p2):
return (p2[1] - p1[1]) / (p2[0] - p1[0])

def find_intercept(slope, point):
return point[1] - slope * point[0]

def equation_of_line(point1, point2):
slope = find_slope(point1, point2)
intercept = find_intercept(slope, point1)

def line_eq(x):
return slope * x + intercept

return line_eq

line_function = equation_of_line((-3, 4), (6, 10))

print(line_function(0)) # Prints the value of y when x = 0 for the line passing through (-3, 4) and (6, 10)
Similar Questions
    1. answers icon 1 answer
  1. HELP ALGEBRA HOMEWORK1. Classify -6x^5+4x^3+3x^2+11 by its degree. A) quinic B) cubic C) quartic D) quadratic 2. Write
    1. answers icon 4 answers
  2. Identify the INCORRECT sentence.A. Amanda worked diligently on her algebra homework. B. Trudy bought a American-made car. C. My
    1. answers icon 4 answers
    1. answers icon 1 answer
more similar questions