I'm trying to convert this array
a = [
['A','B','C'],
[1,33,45],
[721,22,9]
]
to a dictionary in order to have this output:
b = {
'A':[1,721],
'B':[33,22],
'C':[45,9]
}
My current code is like this, getting this error:
b = {}
for i in range(1,len(a)):
for j in range(len(a[i])):
b[a[0][j]].append(a[i][j])
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
KeyError: 'A'
May someone help me in how would be a way to do it. Thanks