human
Sum of elements in given range from Array formed by infinitely concatenating given array | Function to find the sum of elements in a given range of an infinite array.
Stores the sum of array elements from L to R.
Traverse from L to R.
Print the resultant sum.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to sum of elements in given range from Array formed by infinitely concatenating given array and the other steps required.
 def rangeSum ( arr , N , L , R ) :
	sum = 0
	for i in range ( L - 1 , R , 1 ) :
		sum += arr [ i % N ]
	print ( sum )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 5 , 2 , 6 , 9 ]
	L = 10
	R = 13
	N = len ( arr )
	rangeSum ( arr , N , L , R )