diff --git a/nav.py b/nav.py index 55cf4ed..4d9dae3 100644 --- a/nav.py +++ b/nav.py @@ -35,16 +35,19 @@ LAUNCH_FUEL = 380.0 # tonnes of fuel to escape Earth's gravity def distance(a, b): + """Return the distance between two neighboring waypoints.""" if (a, b) in DISTANCES: return DISTANCES[(a, b)] return DISTANCES[(b, a)] def legs(route): + """Return the legs (pairs of consecutive waypoints) of a route.""" return [(route[i], route[i + 1]) for i in range(len(route) - 1)] def plan(destination): + """Return route, distance, travel time (days) and fuel (t).""" route = ROUTES[destination] total = 0.0 fuel = 0.0