human
Can you provide a code to find final value if we double after every successful search in array and the other steps required given the following:
Find final value if we double after every successful search in array | Function to Find the value of k.
Search for k . After every successful search , double k ..
Driver 's Code"
Solution in Python:
assistant
#Here is code to find final value if we double after every successful search in array and the other steps required.
 def findValue ( arr , n , k ) :
	for i in range ( n ) :
		if ( arr [ i ] == k ) :
			k = k * 2
	return k
arr = [ 2 , 3 , 4 , 10 , 8 , 1 ]
k = 2
n = len ( arr )
print ( findValue ( arr , n , k ) )