Write the following function to sort a list of points on their y-coordinates. Each point is a list of two values for x- and y- coordinates. # Returns a new list of points sorted on the y-coordinates...


Write the following function to sort a list of points on their y-coordinates. Each point is a list of two values for x- and y- coordinates.


# Returns a new list of points sorted on the y-coordinates
def sort(points):
For example, the points [[4, 2], [1, 7], [4, 5], [1, 2], [1, 1], [4, 1]] will be sorted
to [[1, 1], [4, 1], [1, 2], [4, 2], [4, 5], [1, 7]]. Write a test program that displays
the sorted result for points [[4, 34], [1, 7.5], [4, 8.5], [1, -4.5], [1, 4.5],
[4, 6.6]] using print(list).



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here