You will write three small functions about the time that danger needs to reach a place.
The idea. Time = distance ÷ speed. Sound moves at 343 m/s. A hot flow of ash is dangerous if it reaches a town in less than a limit of minutes.
Your tasks.
minutes, return the time in minutes for a flow to cover distance km at speed km/h.sound_time, return the seconds that sound needs to travel distance km at 343 m/s.too_close, return a sorted list of the names of the towns where the flow arrives in less than limit minutes. The towns are in a dictionary of names and distances in km.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…