Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Dictionaries Dictionary Basics

Keep getting NameError for first Dictionary Challenge Task and unsure what is wrong with my code!?

I keep getting a NameError when running the attached code and am running into a wall as to what is wrong.. any idea why?

The questions is: Make a dictionary named player and add two keys to it. The first key should be "name" and the value can be any string you want.

The second key should be "remaining_lives". Set this key's value to 3.

Thanks!

dicts.py
player = {"name": "Link", "remaining_lives": 3}

2 Answers

Eric M
Eric M
11,546 Points

Hi Michael,

The good news is you've created a valid Python dictionary. The bad news is I think something has gone a bit wonky with this code challenge. I could be wrong but I've reported it up the chain to be checked out.

In the meantime please continue with the next item in the course while this challenge gets a closer look (you can skip around from the circular breadcrumbs at the top of the videos and challenges).

I've quickly checked out the next challenge in this course and it's working fine. It's also not too long ago that I ran through the Python tracks myself (maybe two months ago) and they were without issue, so I'm sure this'll get fixed up ASAP.

Cheers,

Eric

Eric M
Eric M
11,546 Points

Hi Michael,

To add to this. I am seeing this in some other Python code challenges as well. Unfortunately the main support team works on US time, so it might be a little bit before this gets fixed. Fingers crossed.

Cheers,

Eric

Thank you, much appreciated!

Steven Parker
Steven Parker
231,269 Points

You code looks correct, there might be a bug in the validation mechanism. You may want to make a bug report to the Support folks.

Thanks for confirming!