Question: I'm using using this data to fill a FlatList, each item contains a LinearGradient

```
const DATA = [
  {
    id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba',
    title: 'First Item',
    firstColor: "#f472a7",
    secondColor: "#d84351"
  },
  {
    id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
    title: 'Second Item',
    firstColor: "#50be71",
    secondColor: "#50be71"
  },
  {
    id: '58694a0f-3da1-471f-bd96-145571e29d72',
    title: 'Third Item',
    firstColor: "#e2bd4f",
    secondColor: "#e49074"
  }
];

```

I added two properties called "firstColor" and "secondColor", to fill the LinearGradient colors, but I'm having some issues doing that. I'm receiving this error:

```
TypeError: undefined is not an object (evaluating '_ref3.secondColor')

```

Code:

```
    const Item = ({ title }, { firstColor }, { secondColor }) => (
        <LinearGradient
        colors={[{firstColor}, {secondColor} ]}
        style={styles.item}
        >
          <Text style={styles.title}>{title}</Text>
        </LinearGradient>
      );

      const renderItem = ({ item }) => (
        <Item title={item.title} />
      );
...

        <SafeAreaView style={styles.container}>
        <FlatList
          data={DATA}
          renderItem={renderItem}
          keyExtractor={item => item.id}
        />
      </SafeAreaView>

```

Answer: 
Since Python 3.7, keys in dict are ordered.
-------------------------------------------

You can use enumerate in order to keep track of the position of the element in the dict while iterating over it. Then, you use the `i` as an index on each row of the 2d list, convert each value to int and do a sum of the result.

```py
List2d = [['1', '55', '32', '667' ],
         ['43', '76', '55', '100'],
         ['23', '70', '15', '300']] 

dictionary = {'New York':0, "London": 0, "Tokyo": 0, "Toronto": 0 }

for i, city in enumerate(dictionary.keys()):
    dictionary[city] = sum(int(row[i]) for row in List2d)

print(dictionary)
# {'New York': 67, 'London': 201, 'Tokyo': 102, 'Toronto': 1067}

```
Use pandas

```
#!pip install pandas
import pandas as pd
pd.DataFrame(List2d, columns=dictionary.keys()).astype(int).sum(axis=0).to_dict()

```

output:

```
{'New York': 67, 'London': 201, 'Tokyo': 102, 'Toronto': 1067}

```