# File: Erin/randMax2.py Find max and min # Creates a list with 5 random integers # Python functions max(2,5,3) min(2,5,3) # L = [2,5,3] then tuple(L) is (2, 5, 3) # Method 2. max is last (L[-1] is last from a list) and min is first in a sorted list """ 11 99 86 16 59 [11, 16, 59, 86, 99] Max= 99 Min= 11 """ import random # imports the random library def main(): L = [random.randint(1,100) for i in range(5)] # make a list of print(L, " Max=",max(tuple(L)),"\tMin=",min(tuple(L))) # use min and max python functions # Method 2 L.sort() # sorts the list print(L, " Max=",L[len(L)-1],"\tMin=",L[0]) # max and min, first and last from sorted list print(L, " Max=",L[-1],"\tMin=",L[0]) # max and min, first and last from sorted list main()