You will find the corner points of a region by solving every pair of boundary lines, as in the lesson. The checker tests four regions.
The idea. A rule is (a, b, c) for . The boundary lines are the rules and the two axes. Two lines meet where the equations hold together. We use exact fractions, so a corner such as is not spoiled by rounding.
Your tasks.
meet(line1, line2). Return the point (x, y) where the two lines meet, or None when they are parallel.corner_points(rules). Return the sorted list of different corner points.count_corners(rules). Return how many corner points there are.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…