I get an error when trying to make this program.
from pointLine import * def calcSlope(x1,y1, x2,y2): slope = (x2-x1)/(y2-y1) return slope def calcPointOnLine(y, m, x, b): if y == (m*x)+ b: return True else: return False print "Point is on a Line? Program" line1 = [(1,7), (7,19)] x1 = line1 x2 = line1 y1 = line1 y2 = line1 slope1 = calcSlope(x1,y1,x2,y2) yIntercept = y1 - (((y2 - y1)/(x2 - x1))(x1)) p1 = Point(3,11) pointY1 = p1.y pointX1 = p1.x print "Point(3,11) is on line", line1, ":", \ calcPointOnLine(pointY1, slope1, pointX1, yIntercept) p2 = Point(4,11) pointX2 = p2.x pointY2 = p2.y print "Point(4,11) is on line", line1, ":", \ calcPointOnLine (pointY2, slope1, pointX2, yIntercept)
Here's the dreaded error message:
Traceback (most recent call last): File "C:\Users\Me\assignment.py", line 22, in <module> yIntercept = y1 - (((y2 - y1)/(x2 - x1))(x1)) TypeError: 'int' object is not callable