Currently trying to create an automated function that can find a line between two points. Tried testing this function (by plotting) but when I plot the function I get a ‘v-shaped’ line. What changes can I make to complete this function? Thanks.
import matplotlib.pyplot as plt from math import e x = [0, 9] y = [7, 2] m = (y-x)/(y-x) b = m*(y-x)+x for i in range (-10, 10): prob_x = m*i + b x.append(i) y.append(prob_x) plt.plot(x,y)
import matplotlib.pyplot as plt x = [0, 9] y = [7, 2] plt.plot(x, y) plt.show()
You don’t need to do anything, plt.plot returns a line between two points anyway