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 Dict Basics

confused about a quiz question (dict basics)

set the key color to the value 'red'.

my_car[ _____________ ] = ______________

in the first blank I put: "lambo", and in the second blank I put: {"red"}

I got an error: Bummer! Unfortunately, that answer is incorrect.

what am I doing wrong?

2 Answers

andren
andren
28,520 Points

The first blank should contain the key you are modifying/creating and the second blank should contain the value.

That means that you are creating a key called "lambo" and setting the value to a dictionary containing the string "red", which is not really what the quiz asks for.

The key should simply be "color" and the value just the string "red" like this:

my_car["color"] = "red"

Resurrecting this as I did the above:

my_car["color"] = "red"

and it returned an incorrect answer. Apparently the editor only accepts single quotes?

my_car['color'] = 'red'

Really destroyed my brain for a sec.