human
Find index of first occurrence when an unsorted array is sorted | Python 3 program to find index of first occurrence of x when array is sorted ..
Driver Code"
Solution in Python:

Can you provide a code to find index of first occurrence when an unsorted array is sorted and the other steps required?
assistant
#Here is code to find index of first occurrence when an unsorted array is sorted and the other steps required.
 def findFirst ( arr , n , x ) :
	count = 0
	isX = False
	for i in range ( n ) :
		if ( arr [ i ] == x ) :
			isX = True
		elif ( arr [ i ] < x ) :
			count += 1
	return - 1 if ( isX == False ) else count
if __name__ == " _ _ main _ _ " :
	x = 20
	arr = [ 10 , 30 , 20 , 50 , 20 ]
	n = len ( arr )
	print ( findFirst ( arr , n , x ) )