- 2
Python exercise..... need help struggling
# This function takes a start point and a list of remaining points, and returns the remaining point that is closest to the start point # the list of remaining points must contain at least one point def find_closest(start_point, remaining_points) : # insert code here return closest_point # A test case for the find_closest function find_closest((2.8, 9.8), [(0.3, 8.3), (4.4, 8.8), (6.8, 7.4), (4.1, 0.3), (4.5, 0.0), (7.6, 1.1), (5.0, 8.2), (7.7, 1.8), (3.4, 6.9), (4.8, 3.2), (0.7, 7.9)]) # should return (4.4, 8.8) find_closest((2.8, 9.8), [(0.3, 8.3), (4.4, 8.8), (6.8, 7.4), (4.1, 0.3), (4.5, 0.0), (7.6, 1.1), (5.0, 8.2), (7.7, 1.8), (3.4, 6.9), (4.8, 3.2), (0.7, 7.9)]) == (4.4, 8.8) # should return True
3 Answers
+ 2
Sharon Joseph , Rik Wittkopp ,
i have currently a problem with posting of some answers, so i put some informations in the attached file:
https://code.sololearn.com/cJhbL0eQ20VU/?ref=app
+ 1
Sharon Joseph
What logic in your code dictates that (4.4, 8.8) should be returned?
+ 1
Thanks Lothar
I noticed that the only activity posted by Sharon was to ask that question.
I suspect it was a homework assignment