You will write three small functions about curves given by a parameter. The checker uses an ellipse and a straight line.
The idea. For the ellipse , every point satisfies . For the line , the slope is and the line crosses the -axis where .
Your tasks.
ellipse_point(a, b, t). Return the pair (x, y) for the parameter t.on_ellipse(a, b, x, y). Return True when (x / a) ** 2 + (y / b) ** 2 is within 0.000001 of .line_slope_intercept(x0, y0, a, b). Return the pair (slope, intercept) of the line, where the intercept is the value of when .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…