I have a nested list a = [1, 2, [3, 4], 5]
and I want to apply a function that will raise every number to the power of 2. The result will be like this:
a = [1, 4, [9, 16], 25]
I tried a = [list(map(lambda x : x * x, x)) for x in a]
but it gives this error
'int' object is not iterable
How we can fix this issue? How can I apply a function over a nested list?