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 Introducing Dictionaries Introducing Dictionaries Creating a Dictionary

Connor Fitzpatrick
Connor Fitzpatrick
4,131 Points

How do you assign the value of a key to a variable in a Python dictionary?

The challenge task is saying my code is incorrect and I don't know why. Trying to get the value of the 'topic' key.

creating_dictionaries.py
student = {'name': '', 'topic': 'Python'}
topic = student['topic']

1 Answer

This challenge was previously broken and may have been fixed. Try with lower case 'python' in your dictionary.

Connor Fitzpatrick
Connor Fitzpatrick
4,131 Points

Lowercase 'python' did the trick. Thanks for the fast response!