logo CodeStepByStep logo

nearest_points

Language/Type: Python lists

Write a function called nearest_points that accepts a list of (x, y) tuples representing points on the 2D Cartesian plane, and returns the minimum distance between any two points. To compute the distance between two points, use the Pythagorean Theorem, which states that the distance between two points is the square root of the sum of the squares of the differences in the two dimensions. You may assume that the list contains at least two points and that one pair is uniquely the closest pair.

Bare code: Write a fragment of Python code as described, without any class or function/method heading around your code.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.