You will write three small functions about the octants and the axes. The checker uses points in all eight octants and points on planes and axes.
The idea. The signs of the three coordinates decide the octant. Octants 1 to 4 lie above the -plane and follow the quadrants of . Octants 5 to 8 lie below.
Your tasks.
octant(x, y, z). Return the octant number from 1 to 8, or 0 if any coordinate is zero.count_in_octant(points, n). Count how many points of the list are in octant n.on_axis(x, y, z). Return True if the point lies on an axis, which means that at least two coordinates are zero.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…