I need to create three dictionaries. I want to use a for
loop to do this, but it is not turning out the way I want it to. This is my code:
names=["lloyd", "alice", "tyler"]
for name in names:
name = {
"name": [name],
"homework": [],
"quizzes": [],
"tests":[],
}
The three dictionaries are being created, but are stored in the variable name
. I assumed the second name
(after the line starting the for
loop) would also be substituted with the values stored in names
, but this does not happen. How come? How can I fix this?