Write a Python function multall(array) that multiplies all numbers in all arrays in acascaded set of arrays (a cascaded array). For instance, calling this function on a cascaded array such as in multall([1,5,6,[2,3,[5,4]]]) would return 3600. Hint: use recursion Hint: to check whether the object e is a list, you can use the comparison type(e) ==list in an if statement Note, a cascaded array is a (possibly empty) Python list which can contain either integers or cascaded arrays itself. Secondly: we have to start out with a number that is “neutral” for multiplication, which is 1.We then do a for loop through all elements of the cascaded array. If the element is an integer, multiply it to the existing product. The alternative is that it is a cascaded array itself; in which case, you call the function (recursively) again.
answer:
def multall(arr):
product = 1
for factor in arr:
if type(factor) == list:
product *= multall(factor)
else:
product *= factor
return product
this is the answer, I was wondering if anyone can explain each line thank you very much.