Discuss / Python / 偷懒

偷懒

Topic source

dudefitslol

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

def fminmax(L):

    if not isinstance(L,list):

        raise TypeError('bad operand type')

    elif len(L) == 0:

        return (None,None)

    return(min(L),max(L)) # 偷懒用了自带的min max函数。


  • 1

Reply