Discuss / Python / 交作业

交作业

Topic source

倚叠如山

#1 Created at ... [Delete] [Delete and Lock User]
def findMinAndMax(L):
    if not L:
        return (None, None)
    min_num = max_num = L[0]
    for i in L:
        if i <= min_num:
            min_num = i
        if i >= max_num:
            max_num = i
    return (min_num, max_num)

  • 1

Reply