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 trialSC3 Rocks
33,474 PointsKey Management - Second Challenge...
I am having some trouble with this exercise:
OK, one more step. Now add a "levels" key. It should be a list with the values 1, 2, 3, and 4 in it. And, lastly, add an "items" key. This key's value should be another dictionary. Give it at least one key and value, but they can be anything you want.
Below is the code that I've tried to put input - I would appreciate any assistance that someone could provide - Thank you...
player = {"name": "Melanie Iglesias", "remaining_lives": 3, "levels": [1,2,3,4]}
player2 = {"items": "backpack"}
4 Answers
Jose Soto
23,407 PointsThe items
key needs to be part of the player
value. Also, the items
key should have a value of a dictionary. It is currently set to a string of "backpack".
SC3 Rocks
33,474 PointsI'll take a closer look in the morning - Thanks for your help so far, Jose - I appreciate it...
SC3 Rocks
33,474 PointsThanks a bunch, Jose - I passed the challenge - Thank you... P :)
Peter Rzepka
4,118 Pointsthis passes the challenge also:
player = {"name": "Kenneth", "remaining_lives": 3, "levels": [1,2,3,4], "items": dict([["newkey", "newvalue"]])}
SC3 Rocks
33,474 PointsSC3 Rocks
33,474 PointsI tried adding on to player, but I keep getting the "Task 1 is no longer passing" message:
player = {"name": "Melanie Iglesias", "remaining_lives": 3, "items": {"backpack": "laptop"}
Jose Soto
23,407 PointsJose Soto
23,407 PointsYou are missing a closing
}
Also, don't forget to include"levels": [1,2,3,4]