1. Lesson Number One


#1

Hi,

Here is my code plus the error message that I'm getting:

What could I be doing wrong?

Thanks.


#2

Hi,

you should remove squared brackets in the "name". It should be: "name": "Lloyd",


#3

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?

Thanks.


#4

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.


#5

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.


#6

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.


#7

Ah, that explains it. Thanks. :thumbsup:


#8

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