Lesson Number One


#1


Stuck on the first lesson? Seriously?

File "python", line 3
"homework",
^
SyntaxError: invalid syntax

I've tweaked this one a number of different ways, and referenced a few of the other posts. I'm hitting a wall...


lloyd = {
    "name": "Lloyd",
    "homework",
    "tests":,
    }
alice = {
    "name": "Alice",
    "homework",
    "tests",
    }
tyler = {
    "name": "Tyler",
    "homework",
    "tests",
    }


#2

You have an unwanted colon here on line 3:

Also, check that you have the key-value pairs right.


#3

I'm receiving a syntax error on "homework".


#4

Yeah! So I asked that you check you key-value pairs too. For instance, you only typed key "homework" without its corresponding value.

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

Check for others.


#5

My bad :slight_smile:

So, why the brackets for homework, quizzes, and tests, but not name?


#6

Yeah! This instruction says why:

03. Have the "name" key be the name of the student (that is, lloyd's name should be "Lloyd") and the other keys should be an empty list. (We'll fill in these lists soon!)

Only the name key carries student's name, while other keys take an empty list, represented as square brackets.


#7

I should have learned this stuff at 26 and not 36...


#8

Lol! Keep at it. Practice and more practice will help! :wink:


#9

lloyd = {
"name" : ["Lloyd"],
"homework" : [],
"quizzes" : [],
"tests" : []
}
alice = {
"name" : ["Alice"],
"homework" : [],
"quizzes" : [],
"tests" : []
}
tyler = {
"name" : ["Tyler"],
"homework" : [],
"quizzes" : [],
"tests" : []
}

I dont know what is wrong, but every time it is showing: " Oops, try again. The name key does not have the value "Lloyd" in your lloyd dictionary. "

pls help.


#10

No comma after "tests"?


#11

Ok so I just copied and pasted your code into my lesson browser and the problem is not commas but the brackets around your names. Take away those and you will pass. And if you want an explanation why you should read @bayoishola20 answer above. Which honestly, you should have been able to read and find your problem out by that conversation above.


#12

An empty key value is represented with brackets while key value with a value does not. However, if you use a list as the key value, you would then use brackets.


#13

Thank you Trevor I think this is what was confusing a lot of people, myself included.


#14

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