How can I create a key:value pair in a first loop and then just append values in subsequent loops? For example:
a = [1,2,3]
b = [8,9,10]
c = [4,6,5]
myList= [a,b,c]
positions= ['first_position', 'second_position', 'third_position']
I would like to create a dictionary which records the position values for each letter so:
mydict = {'first_position':[1,8,4], 'second_position':[2,9,6], 'third_position':[3,10,5]}
Imagine that instead of 3 letters with 3 values each, I had millions. How could I loop through each letter and:
- In the first loop create the key:value pair 'first_position':[1]
- In subsequent loops append values to the corresponding key: 'first_position':[1,8,4]
Thanks!