Error I don't understand - 1/9


I keep getting this error I don’t understand. Here’s my code:

lloyd = {
[indent]“name” : “Lloyd”
[indent]“homework” : []
[indent]“quizzes” : []
[indent]“test” : []

alice = {
[indent]“name” : “Alice”
[indent]“homework” : []
[indent]“quizzes” : []
[indent]“test” : []

tyler = {
[indent]“name” : “Tyler”
[indent]“homework” : []
[indent]“quizzes” : []
[indent]“test” : []

and here’s the error:

File “python”, line 3
“homework” : []
SyntaxError: invalid syntax

I’ve tried different configurations, but as far as I can tell I need that colon in there… but no matter what I do, Python has a problem with that colon being there. No matter how I rearrange it–and even removing the colon–Python throws a syntax error.

I’m also expecting it to give me problems for my “empty list” which is just a pair of closed brackets. That’s the only way I can think of to put an empty list in there as the value for the key-value pair, but I 100% expect it to give me problems.


key value pairs are separated by comma’s, which are missing in your case

don’t put all your focus on the line with the error message


I replaced the colons with commas and I’m getting the same error. Also, I don’t think I’ve ever seen a key-value pair use anything but a colon.


The key and the value are separated by a colon, but each key-value pair is separated by a comma, like so:

my_dictionary = {
  "key" : "value",
  "burger" : "delicious",
  "veggies" : "healthy"


Ohhhhhhhhhhhhhhhh, there’s supposed to be a comma at the end of the line. I thought he was saying there’s supposed to be a comma instead of a colon. I was like “What?” I re-read his response ten times to make sure I wasn’t experiencing some acute dyslexia.


Wait. Nope. I’m still getting that same error. This program has just been so insanely frustrating ever since “A Day at the Supermarket.” Every exercise just sets my whole body on fire.


i said: key value pairs are separated by comma’s. key and value are separated by colon indeed, reading and understanding is an important part of programming

Did you insert the colons again? please post an updated version of your code


so "name": "Lloyd" is not a key value pair? Why is there no comma at the end? the key value pair separation by comma applies to all, not only list values


I didn’t have a comma after the names and I had one of the keys named “test” instead of “tests”.
Thank you both so much, I hate when some stupid little mistake brings me to the forums. I’m always so frustrated by the time I get to this point.


yep, programming can be frustrating. But don’t take that out on us :wink: we are just trying help you.

day at the supermarket and students become teachers is tricky, it applies what you learned. Don’t feel ashamed to revisit exercise which teach about functions (parameters, arguments) and dictionaries if you need a syntax refresher.


Oh no! I don’t want to come across like I was taking it out on you guys. I wasn’t anything but grateful for your assistance.


you aren’t :wink: so you are doing a good job keeping your frustration in control

you’re welcome :slight_smile:


Making mistakes is part of learning - don’t beat yourself up too much over it! :slight_smile:

Also, whilst I know the “Up next” prompt at the end of each series of exercises can be quite the motivator to get through the course at speed, I’d encourage you to maybe spend a bit of time at the end of each one messing around with the things you’ve learned in that exercise so you can get more comfortable with how they work, and how you can both break them and fix them. :slight_smile:

Once you’ve completed the exercise, and you’ve got all the green checkboxes, you can carry on tinkering around with your code in the editor and playing around with Python and you won’t lose any of your progress. (I frequently jump back into Python Syntax to test stuff!)


That’s what my friend keeps telling me. My original plan was to get through one segment per day, but that might be too tall an order.
Thanks again for your help and advice.


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