Discuss / Python / day3
def findMinAndMax(L):
    length = len(L)
    if length == 0:
        return (None, None)
    for i in range(0, length):
        for j in range(0, length-i-1):
            if L[j] > L[j+1]:
                temp = L[j]
                L[j] = L[j+1]
                L[j+1] = temp
    return L[0], L[length-1]



  • 1

Reply