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

Levels key

Can any one clarify me on this part of question

dicts.py
player = {"name": "perfect", "remaining_lives": 3, "levels": "[1,2,3,4]", "items": "tino"}

2 Answers

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

I'm pretty sure the goal of the challenge is to show you that dictionaries can contain lists or dictionaries (nested)

There are many types of entries for dictionaries - try something like below:

a = {"key1":"value1", "list1":[1, 3, 5, 7], "dict1":{"nested_key1":"nested_value1"}}
print(a)
# output
{'key1': 'value1', 'list1': [1, 3, 5, 7], 'dict1': {'nested_key1': 'nested_value1'}}
# or check a specific key
print(a['dict1'])
# output
{'nested_key1': 'nested_value1'}

Maybe these will help:

Lists in a dictionary

Nested dictionary

player = {"name": "perfect", "remaining_lives": 3, "levels": [1, 2, 3, 4] "items": {"tino":"pythonista"}}

I keep having bummer wat should do im out of ideas

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

You need a comma before "items"

Dave i did put the comma but i got no lucky bra its stil sayin bummer

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Not sure where you put the comma but below passes the challenge:

player = {"name": "perfect", "remaining_lives": 3, "levels": [1, 2, 3, 4], "items": {"tino":"pythonista"}}

Yah thankx man im really great full it worked...thankx a lot in my home langauge waka nyanya wakuseri

Since you were answered by Dave, i no-longer see it necessary for me to help you out on the challenge .The solution Dave wrote is correct.Lastly, you did not highlight what the question was for the above list dictionary.