Why does the function return none?
I thought list were passed by reference. I added return to the recursive call, it worked. But I'm just wondering why the return did made a difference.
Note: I'm trying to learn recursion
def find_min_max(arr, i, nums):
if i == len(arr):
return nums
if arr[i] < nums[0]:
nums[0] = arr[i]
if arr[i] > nums[1]:
nums[1] = arr[i]
find_min_max(arr, i+1, nums)