1. Lesson Number One


#1


https://www.codecademy.com/courses/python-beginner-en-qzsCL/0/1?curriculum_id=4f89dab3d788890003000096

The first error message I receive is "Did you create a dictionary named lloyd? Your code threw a "global name 'lloyd' is not defined" error.". However, in the console window I receive this error:

File "python", line 15
"homework": [],
^
SyntaxError: invalid syntax

I expect my code to allow me to move onto lesson 2. What strikes me as strange is that the template I use for Tyler's dictionary is the same as Lloyd's and Alice's, but I only get an error for Tyler's.

Is there something I'm missing here?

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


#2

I removed the commas after the last entries in each of the dictionaries as they are redundant, but that did not solve the error.


#3

You have to add a comma after:

"name": "Tyler"

#4

Thanks a bunch! Solved :slight_smile:


#5

You're welcome :slight_smile:


#6

lloyd = {"name" : "lloyd","homework" : ,"quizzes" :, "tests":}
alice = {"name" : "alice", "homework" : , "quizzes" : ,"tests":}
tyler = {"name" : "tyler","homework": , "quizzes" : "tests":}

this is what i wrote in the first lesson of this unit. But it keeps throwing back an error saying the name lloyd is not defined. And since that's like the first name in this code, my code sucks from the beginning.
Can someone help me out with this please?


#7

This is correct code for the lloyd dictionary:

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

As you see the dictionary is built using key : value constructions separated by commas. and you were asked to assign an empty list ([]) to the "homework", "quizzes" and "tests" keys.


#8

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