human
Find the smallest positive number missing from an unsorted array | Set 2 | Function to find smallest positive missing number ..
to store next array element in current traversal.
if value is negative or greater than array size , then it cannot be marked in array . So move to next element ..
traverse the array until we reach at an element which is already marked or which could not be marked ..
find first array index which is not marked which is also the smallest positive missing number ..
if all indices are marked , then smallest missing positive number is array_size + 1..
Driver code"
How can the above be solved in Python?

Write me a code to find the smallest positive number missing from an unsorted array and the other steps required?
assistant
#Here is code to find the smallest positive number missing from an unsorted array and the other steps required.
 def findMissingNo ( arr , n ) :
	for i in range ( n ) :
		if ( arr [ i ] <= 0 or arr [ i ] > n ) :
			continue
		val = arr [ i ]
		while ( arr [ val - 1 ] != val ) :
			nextval = arr [ val - 1 ]
			arr [ val - 1 ] = val
			val = nextval
			if ( val <= 0 or val > n ) :
				break
	for i in range ( n ) :
		if ( arr [ i ] != i + 1 ) :
			return i + 1
	return n + 1
if __name__ == " _ _ main _ _ " :
	arr = [ 2 , 3 , 7 , 6 , 8 , - 1 , - 10 , 15 ]
	arr_size = len ( arr )
	missing = findMissingNo ( arr , arr_size )
	print ( " The ▁ smallest ▁ positive " , " missing ▁ number ▁ is ▁ " , missing )