Python Program to Find Maximum Number From Array Using Recursion
Write Python Program to Find Maximum Number From Array Using Recursion
# Write Python Program to Find Maximum Number From Array Using Recursion
def find_max(L, n):
if n == 1:
result = L[0]
else:
result = max(L[n - 1], find_max(L, n - 1))
return result
L = [33, 44, 77, 22, 66, 55, 11]
ans = find_max(L, len(L))
print(f'Max of {L} : {ans}')
Output:
Max of [33, 44, 77, 22, 66, 55, 11] : 77