You will write three functions: the area of a triangle from its vertices, a test for collinear points and the coefficients of the line through two points. The checker tests many cases.
The idea. The determinant with rows is . Half its absolute value is the area. The line through and is with , and .
Your tasks.
area(p, q, r). Each point is a pair (x, y).collinear(p, q, r). Return True if the three points are on one line.line(p, q). Return the triple (A, B, C).Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…