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

David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

python dictionaries

I need help, I don`t know how to add a list to my dict..

dicts.py
player = {"name": "David", "remaining_lives": 3, "levels": 1,2,3,4 , "items":{"weapons":"sword"}
David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

@Kyle Gunby thank you very much i did that initially but it did not work, but then i realized the reason it did not work is because I forgot to end the line of code that you included.

1 Answer

You need to wrap the list in brackets. Also, you are missing a closing curly bracket.

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