Discuss / Python / 作业

作业

Topic source

月半意

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

def findMinAndMax(L):

    if L == []:

        return (None,None)

    minval = L[0]

    maxval = L[0]

    for x in L:

        if x > maxval:

            maxval = x

        elif x < minval:

            minval = x

    return (minval,maxval)


  • 1

Reply