human
Search an element in given N ranges | Function to return the index of the range in which K lies and uses linear search.
Iterate and find the element.
If K lies in the current range.
K doesn 't lie in any of the  given ranges.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to search an element in given N ranges and the other steps required.
 def findNumber ( a , n , K ) :
	for i in range ( 0 , n , 1 ) :
		if ( K >= a [ i ] [ 0 ] and K <= a [ i ] [ 1 ] ) :
			return i
	return - 1
if __name__ == ' _ _ main _ _ ' :
	a = [ [ 1 , 3 ] , [ 4 , 7 ] , [ 8 , 11 ] ]
	n = len ( a )
	k = 6
	index = findNumber ( a , n , k )
	if ( index != - 1 ) :
		print ( index , end = " " )
	else :
		print ( - 1 , end = " " )