def findMinAndMax(L): if len(L) == 0: return (None,None) elif len(L) == 1: return (L[0],L[0]) else: min = max =L[0] for compNum in L[1:]: if min > compNum: min = compNum if max < compNum: max = compNum return (min,max)
Sign in to make a reply
Gino_wang
def findMinAndMax(L): if len(L) == 0: return (None,None) elif len(L) == 1: return (L[0],L[0]) else: min = max =L[0] for compNum in L[1:]: if min > compNum: min = compNum if max < compNum: max = compNum return (min,max)