Discuss / Python / 作业

作业

Topic source
if len(L) == 0:
    return (None, None)
elif len(L) > 0:
    mintemp = L[0]
    maxtemp = L[0]
    for i in L:
        if i > maxtemp:
            maxtemp = i
        elif i < mintemp:
            mintemp = i
return (mintemp, maxtemp)

List判等需要import operator后调用operator.eq(a,b)方法。


  • 1

Reply