Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,516 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,516 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
218,760 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!