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

Introducing Dictionaries

So this is what they said:

Challenge Task 1 of 2 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.

I just don't understand what they want me to do. (a little confusing)

2 Answers

Owen Bell
Owen Bell
8,060 Points

Define a variable student, assigning to it a dictionary with two key-value pairs, those being:

'name': '',  # An empty string, '' OR ""


'topic': 'python',

thanks for the help guys!

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

It can be confusing at first. There are actually several ways to specify a new dict object.

A very common way is using the form b = {'one': 1, 'two': 2, 'three': 3}

In the challenge:

  • "b" would be replaced by "student"
  • 'one': 1 would be replaced by the key / value pair: 'name': ''
  • 'two': 2 would be replaced by the key / value pair: 'topic': 'python'
  • note that the first value is two single quote marks.

Post back if you need more help. Good luck!