You will write three small functions about light and the Solar System.
The idea. Light travels at m/s. The time to cross a distance is . The Solar System is so big that times are best written in minutes or hours.
Your tasks.
light_time, return the time in seconds for light to travel a distance distance_m in metres.describe, return the text "x minutes" if the time seconds is under one hour, or "x hours" if it is one hour or more. Round x to one decimal place.first_beyond, return the name of the nearest world in worlds that the light has not reached after minutes minutes. The values in worlds are distances in metres, listed from the nearest. Return "none" if the light has passed them all.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…