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

Kevin Lieu
Kevin Lieu
4,329 Points

Now add a "levels" key. It should be a list with the values 1, 2, 3, and 4 in it. Not sure how to perform this task.

Not sure what I am doing wrong.

dicts.py
player = {'name': 'Kevin', 'remaining_lives': 3, 'levels': ([1,2,3,4]), 'item': {'superp': 'man'}

1 Answer

Steven Parker
Steven Parker
231,275 Points

The "levels" part of the task is OK.

But you added a key named item when the challenge asked for items (plural). Also, it looks like you are missing the final close bracket ("}") on the outer dictionary.

Also, the parentheses enclosing the levels list are not necessary.

Steven, you beat me again...

Kevin,

Try to add the new key: value pairs outside of naming the 'player' variable. I'm not sure this is a requirment of the challenge, but seeing as the first part is only wanting you to declare 'player' with two key: value pairs and the second part of the challenge is wanting you to add levels and items.

Kevin Lieu
Kevin Lieu
4,329 Points

Thank you Steven.