Discuss / Python / 迭代

迭代

Topic source

n

#1 Created at ... [Delete] [Delete and Lock User]
def findMinAndMax(L):
    if L == []:
        return (None,None)
    Max=Min = L[0]

    for i in L:
        if i > Max:
            Max = i
        if i < Min:
            Min = i
    return (Min,Max)

  • 1

Reply