You will write three functions about spheres. The checker uses the sphere of the lesson and some points.
The idea. In the centre is and . A point is on the sphere if its distance from the centre equals .
Your tasks.
centre_and_radius(u, v, w, d). Return a tuple (centre, radius). If return (centre, None).position(p, centre, r). Return "inside", "on" or "outside". Compare squared distances, and treat differences smaller than 1e-9 as equal.integer_points(r_squared). Count the points with whole-number coordinates that satisfy . Search with each coordinate from -10 to 10.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…