Discuss / Python / findMinandMax迭代

findMinandMax迭代

Topic source

唐龙ya

#1 Created at ... [Delete] [Delete and Lock User]
# -*- coding: utf-8 -*-def findMinAndMax(L):    if L == []:        return (None,None)    else:        max = min = L[0]    for i in L:        while i > max:            max = i        while i < min:            min = i    return(max,min)

  • 1

Reply