shawntz / eeb-c177-w20

lab section materials for eeb c177/c234 @ucla (winter 2020) 🐻
https://shawnschwartz.com/eeb-c177-w20/
Other
23 stars 1 forks source link

General Question related to 8.6 in the Hw #38

Closed KaranSingh-14 closed 4 years ago

KaranSingh-14 commented 4 years ago

If we create a multilevel dictionary and want to want to add another key with its own distinct values, do we just use the append function with the name of the multilevel dictionary to add it to the list? Or is it that we just use the multi dictionary name then put ['Insert Key here']= 'value'? Thank you

chausteven commented 4 years ago

From what I have read from the book and tried on python, I think the append() function only works with lists and cannot be used as a function for dictionaries. I would just use the ['Key']='value' syntax to add another key and value into the dictionary.