Discuss / Python / 作业

作业

Topic source

祥子920

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

def findMinAndMax(L):

    max = 0

    min = 0

    if len(L) > 0:

        min = L[0]

        max = L[0]

        for x in L:

            if min > x:

                min = x

            if max < x:

                max = x

        return min,max

    else:

        return (None, None) #'您的列表为空,请输入对应的数值'


  • 1

Reply