Question: Function Name: getNextCoordinate ( ) Parameters: wormholeCoordinates ( list ) , currentLocation ( list ) Returns: nextCoordinate ( string ) Description: In the movie Interstellar,
Function Name: getNextCoordinate
Parameters: wormholeCoordinates list currentLocation list
Returns: nextCoordinate string
Description: In the movie Interstellar, astronauts embark on a mission through a mysterious
wormhole near Saturn to find a new habitable planet for humanity, and you've recently joined the
team.
Write a function that takes in two parameters: wormhole coordinates, a list of lists formatted as
locationName and your current coordinates, a list formatted as Your function
should find the coordinate for the closest wormhole relative to your current location and the dis
tance it takes to get there. If the lowest distance is less than or equal to return the string "The
next coordinate is nextcoordinate we can go where nextcoordinate is a list in the format
of the closest wormhole. Otherwise, return the string "Oops..., not enough fuel to
make it to locationName If there is a tie between multiple locations, you should use name of
the one that appeared last in wormholeCoordinates.
NOTE:
The distance between points and is given by
where the symbol represents the taking the square root of the entire part to follow.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
