Discuss / Python / 返回最大最小

返回最大最小

Topic source

岁羽谌谌

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

def findMinAndMax(L):

    if len(L) == 0:

        return (None, None)

    min=L[0]

    max=L[0]

    for i in L:

        if i<min:

            min=i

        if i>max:

            max=i

        # pass

    return(min,max)


  • 1

Reply