# Exercise 3: who gets how long to escape? def arrival_minutes(distance_km, speed_kmh): return distance_km / speed_kmh * 60 hazards = { "pyroclastic flow": 100, # km/h, order of magnitude only (check) "lahar": 30, # km/h in a steep valley (check) "ash fall (wind)": 40, # km/h, a typical wind } for name, speed in hazards.items(): print(f"{name:17s}", end="") for km in (5, 10, 30): print(f"{km:3d} km: {arrival_minutes(km, speed):5.1f} min ", end="") print() # pyroclastic flow 5 km: 3.0 min 10 km: 6.0 min 30 km: 18.0 min # lahar 5 km: 10.0 min 10 km: 20.0 min 30 km: 60.0 min # ash fall (wind) 5 km: 7.5 min 10 km: 15.0 min 30 km: 45.0 min # A pyroclastic flow leaves minutes, so the only defence is leaving before it forms. # A lahar gives a little longer, which is why warning systems in valleys can help.