Discuss / Python / 理性交作业

理性交作业

Topic source

menfrexu

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

思路是迭代去比较每一个元素

    if len(L) == 0:
        return (None, None)
    
    min = L[0]
    max = L[0]
    for n in L:
        if n > max:
            max = n
        if n < min:
            min = n
    return (min, max)

  • 1

Reply