Discuss / Python / 调用sort()函数排序取出最大最小值

调用sort()函数排序取出最大最小值

Topic source

    if L == []:

        return (None, None)

    elif len(L) == 1:

        return (L[0], L[0])

    else:

        L.sort()

        return (L[0], L[-1])


  • 1

Reply