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

I think there is an error with this exercise

Intructions:

Create a dictionary with the following key value pairs: 1) key: 'name', value: '', 2) key: 'topic', value: 'python'. Assign this dictionary to a variable called student.

Answer I tried: dictonary = {"key": "Python", "value": "Python", "key": "Python", "value": "Python"} student = dictonary

creating_dictionaries.py
dictonary = {"key": "Python", "value": "Python", "key": "Python", "value": "Python"}

student = dictonary

1 Answer

Steven Parker
Steven Parker
229,732 Points

The instructions ask you to create a dictionary with " 1) key: 'name', value: '', 2) key: 'topic', value: 'python'"

But the sample above shows a dictionary with keys named "key" and "value", and the value for every key is "Python". It also has more than one of the same key, which is not allowed in a dictionary.

When constructing your solution, you won't need the words "key" or "value". The "key" is what comes in front of the colon (:), and the "value" is what comes after it.

Also, it doesn't affect passing the challenge, but you don't need the intermediate variable "dictonary". You can assign directly to "student" on one line.