From 41e657b6aae9f7feee1475981ef00971d82c0a97 Mon Sep 17 00:00:00 2001 From: Ensign Pixel Date: Sun, 6 Sep 2026 07:44:00 +0200 Subject: [PATCH] docs(nav): add docstrings --- nav.py | 3 +++ 1 file changed, 3 insertions(+) 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