human
Counting Rock Samples | TCS Codevita 2020 | Function to find the rock samples in the ranges.
Iterate over the ranges.
Driver Code.
Function Call"
Solution in Python:
 Give me a code to counting Rock Samples and the other steps required?
assistant
#Here is code to counting Rock Samples and the other steps required.
 def findRockSample ( ranges , n , r , arr ) :
	a = [ ]
	for i in range ( r ) :
		c = 0
		l , h = ranges [ i ] [ 0 ] , ranges [ i ] [ 1 ]
		for val in arr :
			if l <= val <= h :
				c += 1
		a . append ( c )
	return a
if __name__ == " _ _ main _ _ " :
	n = 5
	r = 2
	arr = [ 400 , 567 , 890 , 765 , 987 ]
	ranges = [ [ 300 , 380 ] , [ 800 , 1000 ] ]
	print ( * findRockSample ( ranges , n , r , arr ) )