Python menemukan nilai terkecil dalam daftar
stuff = [37, 7, 19, 29, 5, 13, 31, 17, 23, 11, 3, 2]
print(min(stuff))
# output = 2
Kodi4444
stuff = [37, 7, 19, 29, 5, 13, 31, 17, 23, 11, 3, 2]
print(min(stuff))
# output = 2
def find_small(B,small):
small = small + 1
if small not in B:
return small
else:
return find_small(B,small)
def sort_small (A):
smallest_number = min(A)
if smallest_number > 1:
return smallest_number -1
elif smallest_number < 1:
if 1 not in A:
return 1
else:
print(find_small(A,smallest_number))
else:
print(find_small(A,smallest_number))
sort_small([1,2,3])