Not stuck just curious (student becomes the teacher lesson 1)


#1

I'm curious as to when to place [ ]. Is it onyl when the key has a list? I noticed when I put [ ] around "Lloyd" the error was that the name "Llody" was not in the dictionary. Trying to understand why.

Also are the empty brackes necessary to work as place holders for each key?

lloyd = {
    "name" : "Lloyd",
    "homework" : [],
    "quizzes" : [],
    "tests" : []}
    
alice = {
    "name" : "Alice",
    "homework" : [],
    "quizzes" : [],
    "tests" : []}
    
tyler = {
    "name" : "Tyler",
    "homework" : [],
    "quizzes" : [],
    "tests" : []}
    
print lloyd


#2

At the very least we have to populate all values in a dictionary literal. This is a setup for what is to come, and blocks out our syntax and data structures. What we populate it with is arbitrary. It can be an empty string, a number, a boolean, an empty dictionary or list, a function, or None. For our purposes here, lists are written so they are ready for the next step... Adding some data.

That would make lloyd.name equal a data structure, when the variable implies a primitive string object, which would run counter to the purpose of this member variable.