Discuss / Python / 交作业

交作业

Topic source

疯子_20990

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

def findMinAndMax(L): if not isinstance(L, Iterable): raise TypeError('not Iterable type') a, b = None, None for i in L: if not isinstance(i, (int, float)): raise TypeError('not number type') if a is None or i < a: a = i

    if b is None or i > b:
        b = i

return a, b

  • 1

Reply