You will write three small functions about light-years.
The idea. One light-year is m. To change light-years into metres, multiply. To change metres into light-years, divide.
Your tasks.
ly_to_m, return the distance in metres for a distance ly in light-years.m_to_ly, return the distance in light-years for a distance metres in metres.farthest_within, return the name of the star in stars that is farthest away but not farther than limit_ly light-years. Return "none" if every star is farther than the limit.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…