Here is my code plus the error message that I'm getting:
What could I be doing wrong?
you should remove squared brackets in the "name". It should be: "name": "Lloyd",
That worked! However, I don't understand why I had to remove the square brackets, considering in the example that was given (see below), they used square brackets:
So, how am I supposed to know when to use the square brackets and when not to?
I suppose it's just a codecademy thing. I mean they just wanted You to print 'Lloyd' instead of ['Lloyd'] which would be printed if code looked like yours. But You know, I'm just guessing.
square brackets are used for creating a list. In the example given, a cat has more than one sound but in your code LLOYD cannot have more than one name.
Thank-you! I knew I had something wrong but just couldn't understand why it was wrong. This is a perfect way of remembering that I do not need to create a list if I am just assigning one value to the key of the dictionary.
Ah, that explains it. Thanks.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.