def nested_sum(L):
return sum( nested_sum(x) if isinstance(x, list) else x for x in L )
This was a solution given by Eugenie in the following post: sum of nested list in Python
I just was trying to recreate it without using comprehension list, but I'm not able to get it. How could I do it?