Discuss / Python / 交作业了

交作业了

Topic source

AlexMou54

#1 Created at ... [Delete] [Delete and Lock User]
    if L == []: 
        return (None, None)
    else:
        for x in L:
            if not isinstance(x,(int,float)):
                raise TypeError('bad operand type')

        min1 = L[0]
        max1 = L[0]
        for y in L:
            if min1 > y:
                min1 = y
            if max1 < y:
                max1 =y   
        return (min1,max1)


  • 1

Reply