Lesson Number One


#1

Here is my code:

Lloyd = {
    'Name':['Lloyd'],
    'Homework':[],
    'quizzes':[],
    'tests':[],
}
Alice = {
    'Name':['Alice'],
    'Homework':[],
    'quizzes':[],
    'tests':[],
}
Tyler = {
    'Name':['Tyler'],
    'Homework':[],
    'quizzes':[],
    'tests':[],
}

and it says:

Oops, try again. Did you give lloyd the name key?

What am I doing wrong????


#2

Note that the dictionary names are not capitalized. lloyd, alice, tyler.

This is the name key referred to in the error message. Likewise, the key names are not capitalized. The name should be a plain string without a list wrapper.

`name`: "Lloyd",

follow through with this in the rest of your dictionaries.


#3

Why should it it be
'name' : 'Lloyd' ,

instead of
'name' : ['Lloyd']?


#4

What do the instructions ask for? It would not make sense to put a plain string all by itself in a list. We would have to refer to by the structure...

lloyd['name'][0]

to get at the name. Consider,

   lloyd = { 'name': ['Lloyd']}
   print lloyd['name']          # ['Lloyd']
   print lloyd['name'][0]       # 'Lloyd'

#6

Thanks for all your help! :grin:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.