if not (d2 <= d1 <= d3)
if not (d2 <= d1 and d1 <= d3)
ド・モルガンの法則で
if d1 < d2 or d1 > d3
一番上のpython流のbetweenが好きな人もいれば、下の様にnotがない方が好きだという人もいるだろう。