so I was trying to reverse an array by recursion so the code logic is we are swaping right most end value to the left most end. I have implemented logic but the thing is My recursion function retuns None when I explicity wants to return the reversed array. so I wanna know why it is returning None when I was trying to return an array. I have given a code below so please someone can explain me why it is happening and thank you in advance
def reverse_array(left,right,array):
if left > right:
return array
swap = 0
swap = array[left]
array[left] = array[right]
array[right]=swap
reverse_array(left+1,right-1,array)
array = [1,2,3,4,5]
print(reverse_array(0,4,array))
return reverse_array(left+1,right-1,array)Happy Coding!