Discuss / Python / 交作业时间!

交作业时间!

Topic source

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

def findMinAndMax(L):

    if len(L)== 0:

        return None,None

    for i in L:

        if not isinstance(i,(int,float)):

            continue

        else:

            max ,min = i,i

            break

    for i in range(len(L)):

        if not isinstance(L[i],(int,float)):

            print(L[i] + " is not int or float type")

            continue

        elif L[i] > max:

            max = L[i]

        elif L[i] < min:

            min = L[i]

    return max,min


  • 1

Reply