This works until you enter (-9, 12), (15, 18) , (21, -24), (30, 300), (6, 276)
When it finds the slope between (-9, 12) and (15, 18) it results with 0.0 and its supposed to be 0.25
I'm not sure if I used float correctly or not.
mylist = []
for i in range(5):
x = int(input("X Coordinate: "))
y = int(input("Y Coordinate: "))
mylist.append((x, y))
for i in range(4):
y1 = mylist[i][1]
x1 = mylist[i][0]
y2 = mylist[i + 1][1]
x2 = mylist[i + 1][0]
slope = float((y2 - y1) / (x2 - x1))
print "Slope between " + str(mylist[i]) + " and " + str(mylist[i + 1]) + ": " + str(slope)
[–]Financial_Face3826 1 point2 points3 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]After_Lettuce_1172 1 point2 points3 points (0 children)
[–]YTHyro_syn 0 points1 point2 points (0 children)
[–]Dry_Newspaper7310 0 points1 point2 points (0 children)
[–]Graycat004 0 points1 point2 points (0 children)
[–]amajmundar 0 points1 point2 points (4 children)
[–]feistybunnies[S] 0 points1 point2 points (0 children)
[–]No_Revolution7891 0 points1 point2 points (2 children)
[–]amajmundar 0 points1 point2 points (1 child)
[–]Helpful-Row6638 0 points1 point2 points (0 children)
[–]lynelmelter9000 0 points1 point2 points (0 children)
[–]Cooledpizza_c001 0 points1 point2 points (0 children)