You will write functions that decide how a line meets a circle, find the length of a tangent, and count the tangent lines in a list.
Your tasks.
common_points, return 2, 1 or 0, the number of points a line at distance d from the centre shares with a circle of radius r.tangent_length, return the length of the tangent from a point at distance ot from the centre of a circle of radius r.count_tangents, return how many of the distances in a list give a tangent line, for a circle of radius r. Then set n to the answer for r = 5 and the distances [3, 5, 5, 7, 2.5].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…