I'm working on Python and I want to make an element-wise sum of each list within 3 lists of lists. I'll try to simplify the problem to explain better.
Input:
a = [['alpha','beta','gamma'],['delta','epsilon','zeta'],['eta','theta','iota']]
b = [['AB'],['CD'],['EF']]
c = [['1','2','3'],['4','5','6'],['7','8','9']]
The outcome I need is:
d = [['alpha','beta','gamma','AB','1','2','3'],['delta','epsilon','zeta','CD','4','5','6'],['eta','theta','iota','EF','7','8','9']]
What I tried is:
d = []
for x in a:
y = [a[x] + b[x] + c[x]]
d.append(y)
However I get the error "TypeError: list indices must be integers or slices, not list" because x is defined as a list equal to ['alpha','beta','gamma']