You will write three functions that find the bounds of rounded measurements and of an area built from them.
The idea. A value rounded to a given accuracy lies half of that accuracy below and above it. For an area, the largest value uses the upper bounds of both sides and the smallest uses the lower bounds.
Your tasks.
lower_bound(value, accuracy). Return value - accuracy / 2.upper_bound(value, accuracy). Return value + accuracy / 2.area_bounds(length, width, accuracy). Both sides are rounded to the same accuracy. Return the pair (smallest area, largest area).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…