To find the maximum value, repeating twice seems redundant to me. First, to flatten the list, and then to search for the maximum value. Here is an example of creating a recursive function to return the maximum value of a nested list in one iteration as follows:
Run Example:
>>> my_list = [2,4,6,[5,10,3]] >>> get_max(my_list) 10
source share