finding all the smallest numbers up to n in an list code example

Example 1: find the largest and smallest numbers in a list

#Exercise 3 -  Find the largest and smallest number in a list
thislist = input("How many numbers do you want to enter:")
newlist = []
for x in range (0, int(thislist)):
 owl = int(input("Please Enter your numbers:"))
 newlist.append(owl)
print ("The max number entered is:", max(newlist))
print ("The min number entered is:", min(newlist))

Example 2: find the largest and smallest numbers in a list

thislist = [677,8765,8765,876,470,754,6784,56789,7658,]
thislist.sort()
print ("The smallest number is: " + str(thislist[0]))
print ("The largest number is: " + str(thislist[-1]))

Tags:

Misc Example