I have three arrays of that look something like this:
[1,0,0,0,2,0,3,0,0,4,0,1,0,0,0,1]
[2,0,0,0,0,0,2,0,0,3,0,0,0,1,0,1]
[0,0,1,0,0,0,1,0,1,0,0,0,2,0,0,0]
Every number represents another value:
```
1 = "apple"
2 = "banana"
3 = "boat"
```
My goal is to merge them and place them as lists in dictionary keys 1:16 where each key represents an index in the array:
```
{0: ["apple","banana"] 1: [] 2: ["apple"] 3: [] 4 ["banana"]...}
```
Now I've twisted my brain into a knot.
multiarray = zip(a1,a2,a2)
def arraymerger(zippedarrays):
d = {}
for i in range(16):
d[f'{i}'] = []
for a1, a2, a3 in wop:
if a1 == 1 or a2 == 1 or a3 == 1:
d[f'{i}'].append('apple')
elif a1 or a2 or a3 == 2:
d[f'{i}'].append('banana')
elif a1 or a2 or a3 == 3:
d[f'{i}'].append('boat')
return d
merged_dict = arraymerger(multiarray)
The output I get is all the apples, bananas, and boats (and multiple instances of them) in the first key of the dictionary.
I know I'm probably looping over the wrong thing or using the wrong if statement but I'm going a bit nuts.
Can you please help me?