import math begins=4 dsg = 3.1, 31, 45, 1031 cuts=[math.fabs(cs-begins) for cs in dsg] min(cuts) max(cuts)