# prize35-11 Exercise 3: a species squeezed up a mountain by warming LAPSE = 6.5 # degrees C lost per km of height BASE_TEMP = 12.0 # mean temperature at the foot of the mountain today TOP = 1000 # height of the summit in metres WARM, COOL = 12.0, 8.0 # the species lives where the mean temperature is between 8 and 12 C print("warming lowest (m) highest (m) band on mountain (m)") vanish = None for tenths in range(0, 81, 5): dt = tenths / 10 t0 = BASE_TEMP + dt low = max(0.0, (t0 - WARM) / LAPSE * 1000) high = min(float(TOP), (t0 - COOL) / LAPSE * 1000) width = max(0.0, high - low) if tenths % 10 == 0 and dt <= 8: print(f"{dt:5.1f} C {low:9.0f} {high:11.0f} {width:19.0f}") if vanish is None and width == 0: vanish = dt print("first warming (in steps of 0.5 C) at which no suitable height is left:", vanish, "C") # Output: # warming lowest (m) highest (m) band on mountain (m) # 0.0 C 0 615 615 # 1.0 C 154 769 615 # 2.0 C 308 923 615 # 3.0 C 462 1000 538 # 4.0 C 615 1000 385 # 5.0 C 769 1000 231 # 6.0 C 923 1000 77 # 7.0 C 1077 1000 0 # 8.0 C 1231 1000 0 # first warming (in steps of 0.5 C) at which no suitable height is left: 6.5 C # Reading it: the band slides up the mountain as it warms, and from 3 C it is cut off by the summit and shrinks. # At 6.5 C the band has moved above the summit and the species has nowhere left to go. This is the 'escalator to extinction' for mountain species.