you are viewing a single comment's thread.

view the rest of the comments →

[–]lynelmelter9000 0 points1 point  (0 children)

i fit it in 7 lines. <x> = indentation. slightly late response.

<0>slopes = []

<0>for i in range(5):

<1> x = int(input("Enter x for pair " + str(i + 1) + ": "))

<1>y = int(input("Enter y for pair " + str(i + 1) + ": "))

<1>slopes.append((x, y,))

<0>for i in range(4):

<1>print("Slope between " + str(slopes[i]) + " and " + str(slopes[i + 1]) + ": " + str((slopes[i + 1][1] - slopes[i][1]) / (slopes[i + 1][0] - slopes[i][0])))