given a set of points in a plane check weather the points lie on a straight line or not if the lie on straight line return the equation else return 0 in python
Answers
Answered by
0
Answer:
Your answer is given below:
Explanation:
All 3 points lie on the same straight line. Formula To Calculate Slope of 2 points. Slope of points (x1, y1) and (x2, y2) = m ...
Answered by
0
Explanation:
# Python program to check
# Python program to check# if three points are collinear
def collinear(x1, y1, x2, y2, x3, y3):
a = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)
if (a == 0):
print ("Yes")
else:
print("no")
#For example
x1, x2, x3, y1, y2, y3 = 1, 1, 1, 1, 4, 5
collinear(x1, y1, x2, y2, x3, y3)
#Output = Yes
#SPJ2
Similar questions
Economy,
1 month ago
Geography,
1 month ago
Hindi,
2 months ago
India Languages,
10 months ago
Science,
10 months ago