Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Introducing Dictionaries Introducing Dictionaries Creating a Dictionary

Ava Jones
Ava Jones
1,435 Points

What am I doing wrong

I have no idea what is wrong, please help

creating_dictionaries.py
student = {'topic': 'python'}

3 Answers

Shem Ogweno
Shem Ogweno
13,563 Points

Here is one way of doing it!

#Task 1 of 2
student = {
    'name': 2,
    'topic': 'python'
}
# Task 2 of 2
topic = student['topic']
Ava Jones
Ava Jones
1,435 Points

Thank you! It helped !

Shem Ogweno
Shem Ogweno
13,563 Points

There is nothing wrong with what you are doing! The question wants you to have two key-value but you have only given one

1) key: 'name', value: 2,

2) key: 'topic', value: 'python'.

Ava Jones
Ava Jones
1,435 Points

Thank you so much for helping

Asher Orr
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Asher Orr
Python Development Techdegree Graduate 9,022 Points

Hi Ava!

The challenge says to include both key:value pairs in the dictionary.

You added the second key:value pair (key: 'topic', value: 'python') correctly. You just need to add the first one:

key: 'name', value: ''

Like this:

student = {key:value, 'topic':'python'}
Ava Jones
Ava Jones
1,435 Points

Thank you for helping me again!

Ava Jones
Ava Jones
1,435 Points

Hold on I still got an error, it said that key is not defined