Write three tools for the distance formula and the sign test, and check them against a second method.
The idea. The distance of from is . Parallel lines and are apart. Two points are on the same side when has the same sign at both.
Your tasks.
distance, return the distance of the point (x1, y1) from the line.parallel_distance, return the distance between the two parallel lines with the same A and B.same_side, return True when the two points are strictly on the same side, and False otherwise. A point on the line is on neither side.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…