Student Becomes the Teacher: Lesson Number One


#1

Hi there,

I'm about to go crazy looking over this code. I can't seem to figure out what is going on. When I click "Save and Submit" I receive two messages:

1) a pop-up stating "Oops, try again. Did you create a dictionary named lloyd? Your code threw a "global name 'lloyd' is not defined" error"

and 2) "File "python", line 9
"homework": [],
^
SyntaxError: invalid syntax:"

in the console on the right.

Here is my code:

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

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

I've tried adding a space between "name" and the colon, switching to the single ' instead of ', double checked that I wasn't misspelling anything, and yet I can't seem to get out of this. What important but apparently not obvious to me mistake am I making?


#2

The above lines are missing a comma at the end.


#3

Ugh. Thank you! Does anyone have any idea why it stated that the issue was in the lloyd dictionary instead of the alice and tyler dictionaries?


#4

The SCT is not as robust as Python, and has only a small selection of error messages. Sometimes they do not jive. However, the compiler errors raised by Python are generally pretty exact.

Notice where line 9 is? Right after "Alice".


#5

Ah. Fantastic! Thank you for helping me understand all of this.


#6

3 posts were split to a new topic: Student Becomes the Teacher: name has not the expected value


#9

A post was merged into an existing topic: Student Becomes the Teacher: name has not the expected value