Answer:
The program in recursion is:
def find_max(nums):
if len(nums) == 0:
return "None"
elif len(nums) == 1:
return nums[0]
else:
return max(nums[0],find_max(nums[1:]))
Step-by-step explanation:
This line defines the function
def find_max(nums):
This checks if the list is empty.
if len(nums) == 0:
If yes, it returns "None"
return "None"
If the list has just one element
elif len(nums) == 1:
It returns the only element as the maximum
return nums[0]
If the list has numerous elemente
else:
The maximum is determined recursively
return max(nums[0],find_max(nums[1:]))
To the (b) part:
This program does not necessarily need to be done recursively because the max built-in function can be used to determine the maximum of the list in just one line of code and it is more efficient.