Discuss / Python / zy

微辣二毛

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

def findMinAndMax(L):

    if not isinstance(L, (list)):

        return '请输入一个list'

    if len(L) == 0:

        return (None, None)

    else:

        Max = Min = L[0]

        for i in L:

            if i >= Max:

                Max = i

            if i <= Min:

                Min = i

        return (Min, Max)


  • 1

Reply