Forecasters give a cyclone's position every six hours as a latitude and a longitude. Here is a model track of a cyclone moving north through the Bay of Bengal. You will find how far and how fast it moves.
The idea. The distance between two points on a sphere of radius comes from the haversine formula. With the latitudes and longitudes in radians, first work out
Then and .
Your tasks.
distance_km, return the distance between two points.speeds, return the list of speeds in km/h for each six-hour step.track_length, return the total length of the track.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…