suppose I have a list as
mylist = [[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18]]
If I want to add element-by-element then I can use logic as:
[x+y for x,y in zip(mylist[0],mylist[1],mylist[2],mylist[3],mylist[4],mylist[6]]
and it will give sum of columnwise elements. But the problem is , writing each index of mylist inside zip function is somewhat awkward and vague if mylist happens to be list of say 1000 lists and I need to do the element by element operation.
I tried putting loop inside the zip function but it doesn't work. So any idea for that??
It should work like
zip(for k in mylist) # or something else
Thanks