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 GetN
a=[4,3,8,2,5] temp=4 def getSmaller(temp,alist): alist.sort() for i in range(len(alist)): if(i>0 and alist[i]==temp): print alist[i-1] elif(i==0 and alist[i]==temp): print alist[i] getSmaller(temp,a)