Driver code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT arr = [ 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 ] NEW_LINE queries = 3 NEW_LINE q = [ [ 2 , 4 ] , [ 2 , 6 ] , [ 5 , 8 ] ] NEW_LINE n = len ( arr ) NEW_LINE for i in range ( queries ) : NEW_LINE INDENT print ( findSum ( arr , n , q [ i ] [ 0 ] , q [ i ] [ 1 ] ) ) NEW_LINE DEDENT DEDENT