For example I have a non-ordered list of values [10, 20, 50, 200, 100, 300, 250, 150]
I have this code which returns the next greater value:
def GetNextHighTemp(self, temp, templist): target = int(temp) list =  for t in templist: if t != "": list.append(int(t)) return str(min((abs(target - i), i) for i in list))
e.g. If temp = 55, it will return '100'.
But how can I get the lesser of the value? That is how to get it to return '50'?