I am trying to write a function (for academic reasons) that multiply every number in this list : list = [[6 , [1, 2, 3]]
I have tried this solution:
def grow(arr):
for num in arr:
x = num
x * num
for value in num:
y = value * num
return y * x
But I keep getting: TypeError: 'int' object is not iterable someone help me understand please. The expected output should be: 36
Read more here: https://stackoverflow.com/questions/66344838/multiply-items-in-list
Content Attribution
This content was originally published by Davi Cheli Miquelim at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.