Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

find smallest element not present in list python

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])
 
PREVIOUS NEXT
Tagged: #find #smallest #element #present #list #python
ADD COMMENT
Topic
Name
5+4 =