Name key problem


#1
lloyd = {
    "name": ['Llyod'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

alice = {
    "name": ['Alice'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

tyler = {
    "name": ['Tyle'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

The the issue is "Oops, try again. The name key does not have the value "Lloyd" in your lloyd dictionary."


#2

You put "Llyod" instead of "Lloyd".:smiley:


#3

Nevermind, I mispelled Lloyd lol.


#4

Oh, well, that works, haha. :smiley:


#5

Wait I cahnged the name but the message still pops out :frowning:


#6

You also wrote "Tyle" instead of "Tyler". :smiley:


#7

yea I changed it but lloyd still ain't there :frowning:


#8
lloyd = {
    "name": ['Lloyd'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

alice = {
    "name": ['Alice'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

tyler = {
    "name": ['Tyler'],
    "homework": [],
    "quizzes": [],
    "tests": []
}

My new code


#9

Show it again?:smiley:


#10

lloyd = {
"name": ['Lloyd'],
"homework": [],
"quizzes": [],
"tests": []
}

alice = {
"name": ['Alice'],
"homework": [],
"quizzes": [],
"tests": []
}

tyler = {
"name": ['Tyler'],
"homework": [],
"quizzes": [],
"tests": []
}

Here it is :smile:


#11

Did you call them as variables, or did you put them in a variable altogether?

What's the error message?


#12

There is no error message but it wouldn't let me pass because

Oops, try again. The name key does not have the value "Lloyd" in your lloyd dictionary.

But when I print lloyd["name"], I can see "Lloyd" is there


#13

Found it. :smiley:

You shouldn't put the names in an array, but as a string. :smiley:

What I mean is that don't put it inside the block brackets.


#14

It works ! thank you so much!


#15

I don't understand where i am wrong. please, help me out


#16

I just got it to work by removing the square brackets from each name list - e.g:

lloyd = {
    'name': 'Lloyd',
    'homework': [],
    'quizzes': [],
    'tests': []
}

Maybe it's due to there only being one item in the name list?


#17

That helped me alot
thx


#18

Hey @codemasternitish,

You probably found out the problem, but I'll tell you: You have to take out the [] that are next to the names, like ['Lloyd'] should be 'Lloyd'. :smiley:


#19

It's because, I'm guessing, that since we are looking at the property name as a string, we don't include brackets around it, making it an array. Like, we are using the other properties as numbers, not strings.

Then we can use those arrays to combine the properties together, and make the class averages of each.