I worked on using the slope and the distance formula here. But I think indexing is the wrong approach, or is it?
class Line():
def __init__(self,coord1,coord2):
self.coord1 = coord1
self.coord2 = coord2
def distance(self):
return ((coord2[0]-coord1[0])**2 + (coord2[1]-coord1[1])**2)**0.5
def slope(self):
return (coord2[1] - coord1[1])/(coord2[0]-coord1[0])