Prize37 Chapter 2, Exercise 1 Over the hill or round it? Task A canal must gain 18 m of height. Option A goes straight over, 8 km long, using locks that each lift 3 m and take 20 minutes. Option B is a contour canal with no locks, 13 km long. Boats move at 3 km/h. Which is quicker, by how much, and what else would you weigh up before choosing? Code (run with Python) rise = 18.0 lock_lift = 3.0 direct_km = 8.0 contour_km = 13.0 walk_kmh = 3.0 lock_minutes = 20 locks = round(rise / lock_lift) direct_h = direct_km / walk_kmh + locks * lock_minutes / 60 contour_h = contour_km / walk_kmh print("locks on direct route:", locks) print("direct route hours:", round(direct_h, 2)) print("contour route hours:", round(contour_h, 2)) print("extra distance on contour route (km):", contour_km - direct_km) Output (exactly as printed) locks on direct route: 6 direct route hours: 4.67 contour route hours: 4.33 extra distance on contour route (km): 5.0 Answer The contour route is quicker by about 0.34 hours (roughly 20 minutes), even though it is 5 km longer, because six lock passages cost two hours. Other things to weigh: locks need a steady water supply and keepers (Chapter 4 onwards), while the longer canal needs more land, more digging along the hillside and more banks that can leak. The answer would flip if the locks were quicker or the detour longer, which is why builders did this sum for each hill.