human
Sum of elements in range L | Function to find the sum between L and R.
array created.
fill the first half of array.
fill the second half of array.
find the sum between range.
Driver Code"
Solution in Python:
 Write me a code to sum of elements in range L and the other steps required?
assistant
#Here is code to sum of elements in range L and the other steps required.
 def rangesum ( n , l , r ) :
	arr = [ 0 ] * n ;
	c = 1 ; i = 0 ;
	while ( c <= n ) :
		arr [ i ] = c ;
		i += 1 ;
		c += 2 ;
	c = 2 ;
	while ( c <= n ) :
		arr [ i ] = c ;
		i += 1 ;
		c += 2 ;
	sum = 0 ;
	for i in range ( l - 1 , r , 1 ) :
		sum += arr [ i ] ;
	return sum ;
if __name__ == ' _ _ main _ _ ' :
	n = 12 ;
	l , r = 1 , 11 ;
	print ( rangesum ( n , l , r ) ) ;