k closest to the shop

points is a list of (x, y) coordinates and the shop is at (0, 0). Write k_closest(points, k) that returns the k points nearest the shop, ordered from nearest to farthest. No two points in the checks are at the same distance.

k_closest([(3, 3), (5, -1), (-2, 4)], 2)  ->  [(3, 3), (-2, 4)]
k_closest([(1, 3), (-2, 2)], 1)           ->  [(-2, 2)]

The point is to practise a heap of tuples keyed by a computed value. Compare squared distances, x * x + y * y, and skip the square root.

def k_closest(points, k):
    ...