Discuss / Python / 找出最大最小值

找出最大最小值

Topic source

画手

#1 Created at ... [Delete] [Delete and Lock User]

def findMinAndMax(L):

    if len(L)==0:

        return None,None

    else:

        max=min=L[0]

        for i in L:

            if max<i:

             max=i

        for i in L:

            if min>i:

                min=i

        return min,max


  • 1

Reply