Lesson Number One


Here is my code:

Lloyd = {
Alice = {
Tyler = {

and it says:

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

What am I doing wrong????


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.


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

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


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...


to get at the name. Consider,

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


Thanks for all your help! :grin:


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