Discuss / Python / 7.12迭代

7.12迭代

Topic source

夏漾年华

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

def findMinAndMax(L):

    if L == []:

        return (None, None)

    lmin = L[0] 

    for i in L:

        if i < lmin:

            lmin = i

    lmax = L[0]

    for i in L:

        if i > lmax:

            lmax = i            

    return (lmin, lmax)


  • 1

Reply