I'm trying to programmatically set a values to each item in a list inside a nested dictionary.
for example, let's say my initial dictionary, which I constructed is:
{'Abraham': {'subjects': ['Chem', 'Bio', 'Phy', 'Math']}}
Given some lists of values:
assess_type = ['Quiz', 'HW', 'ATTND', 'Exam']
chem = ['127', '135', '17', '46']
bio = ['154', '64', '14', '54']
phy = ['115', '115', '15', '55']
math = ['140', '160', '20', '40']
And I want to achieve a result like this:
{'Abraham': {'subjects': [
'Chem': {'Quiz': '127', 'HW': '135', 'ATTND': '17', 'Exam': '46'},
'Bio': {'Quiz': '154', 'HW': '64', 'ATTND': '14', 'Exam': '54'} ,
'Phy': {'Quiz': '115', 'HW': '115', 'ATTND': '15', 'Exam': '55'},
'Math': {'Quiz': '140', 'HW': '160', 'ATTND': '20', 'Exam': '40'}
]}}
I can construct the dictionary itself, but where I am having issues is how to set the values programmatically. how do I index into the list inside the dictionary and set the value like that programmatically if I just have a list of values as written above?