Wednesday, July 8, 2015

Max number in list



def minmax1 (x):
    # this function fails if the list length is 0
    minimum = maximum = x[0]
    for i in x[1:]:
        if i < minimum:
            minimum = i
        else:
             if > maximum: 
             maximum = i

    return (minimum,maximum)