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

james mchugh
james mchugh
6,234 Points

In the video they showed strings the test wants integers

I'm not getting how to do this. Showing us how to do something before they test us make this learning process much easier. Maybe this was taught in Python basics. A refresher before the test would be nice. Happens here so much. I'm ready to quit and save the $25 a month!

dicts.py
player = {"name": "Jim", "remaining_lives": 3}
player = {"levels": 1 2 3 4, "items": {"number": 7}

1 Answer

Daniel Turato
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Daniel Turato
Java Web Development Techdegree Graduate 30,124 Points

You have the right idea, but the levels value needs to be a list so the numbers should be surrounded by [ ]'s. Also, you need to do this all in one line as by assigning these key's & values the second time will reset the first assignment.

Your code should look like this then:

player = {"name" : "daniel", "remaining_lives" : 3, "levels" : [1,2,3,4], "items" : {"sword" : 1}}