Discuss / Python / 作业

作业

Topic source

Rayn-S

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

大家都大同小异啊。

def findMinAndMax(L):
    if not L:
        return (None, None)
    min = L[0]
    max = L[0]
    for x in L:
        if x <= min:
            min = x
        elif x >= max:
            max = x
    return (min,max)

  • 1

Reply