python find the smallest number in a list code example
Example 1: find the smallest number in list by comparison python
def smallest_num_in_list( list ):
min = list[ 0 ]
for a in list:
if a < min:
min = a
return min
Example 2: python find smallest value in list
stuff = [37, 7, 19, 29, 5, 13, 31, 17, 23, 11, 3, 2]
print(min(stuff))
# output = 2