Exercise 2 solution (Python) def to_min(t): h, m = t.split(":") return int(h) * 60 + int(m) def to_clock(mins): return f"{mins // 60:02d}:{mins % 60:02d}" def naismith(dist_km, ascent_m): return round(dist_km * 12 + ascent_m / 100 * 10) def plan(start, legs, stops, dark, margin=60): walking = sum(naismith(d, a) for d, a in legs) finish = to_min(start) + walking + stops latest = to_min(dark) - margin status = "OK" if finish <= latest else "TOO LONG" return walking, to_clock(finish), status legs = [(3.0, 200), (4.0, 400), (5.0, 0)] print(plan("09:00", legs, 45, "16:30")) print(plan("13:00", legs, 45, "16:30")) Output: (204, '13:09', 'OK') (204, '17:09', 'TOO LONG') The legs take 56 + 88 + 60 = 204 minutes of walking. Starting at 09:00 with 45 minutes of stops you finish at 13:09, well before the latest safe time of 15:30 (dark at 16:30 less a 60 minute margin). Starting at 13:00 you would finish at 17:09, after dark, so the plan is rejected at the table, not discovered on the hill.