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

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}}