Discuss / Python / 迭代 打卡

迭代 打卡

Topic source

某猪头四

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

def findMinAndMax(L):

    if len(L) == 0:

        return(None,None)

    else:

        max=L[0]

        min=L[0]

        for v in L:

            if v < min:

                min = v

            if v > max:

                max = v

        return(min,max)


  • 1

Reply