Input distance: 376291900 Output time: 1.255175
Speed of Light
You will learn about: submitting code and that light is fast.
Light is really fast: 299,792,458 meters per second to be exact. That's fast enough to make it almost 7.5 times around the Earth in one second! A spacecraft would take a few days to reach the Moon, but a beam of light could do it in 1.255 seconds.
We can calculate how long it takes a beam of light to reach places in space. Since light travels at a constant speed $c$, the time $t$ it takes to travel a distance $d$ is $t = d/c$. Try to submit some code with a function light_time(distance) that returns the time it takes light to travel that distance.
Input: A distance in meters (m).
Output: The time it takes for light to travel the input distance, in seconds (s).
|Maximum runtime||60 s||Max. memory usage||250 MiB|
Write a function that accepts the input as function parameters and returns the correct output. Make sure to read the description above to produce the correct output in the correct format and use the correct function signature so we can run your code. A good first step is to try reproducing the example(s). Your code must not take longer than the maximum runtime to run and must not use more memory than the allowed limit.
You must be logged in to view your submissions.
Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Feel free to post your solutions but if you do please organize and document your code well so others can learn from it.