3. Put it together - strange warning for "Oops, try again. It looks like Lloyd is not in the students list."


#1

Oops, try again. It looks like Lloyd is not in the students list. This is the warning for the below code:

lloyd = {
"name": "Lloyd",
"homework": [90.0,97.0,75.0,92.0],
"quizzes": [88.0,40.0,94.0],
"tests": [75.0,90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"name": "Tyler",
"homework": [0.0, 87.0, 75.0, 22.0],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}

students = ["Lloyd", "Alice", "Tyler"]

Just dont understand how it cannot find the value lloyd!!


#2

you store strings in the list, you should store the the dictionary's.


#3

I have only read that a dictionary can store lists. Didnt know that lists could store dictionaries.


#4

Could you please illustrate with an example? Thanks.


#5

an example:

example_dict = {
  "prop1": "val1",
  "prop2": "val2",
  "prop3": "val3",
} 
example_list = [example_dict]

#6

That was simple, but never mentioned anywhere in the reads.
Appreciate the help. Thanks a lot.


#7