Extended. You will test whether two vectors are parallel and whether three points lie on one line, with the cross product , which is zero for parallel vectors.
Your tasks.
cross, return .collinear, return True when the points p, q and r lie on one straight line. Test whether the vector from p to q is parallel to the vector from p to r.on_line to the list of points from candidates that lie on the line through (1, 2) and (3, 5), in the order they are given.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…