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 trialMatthew Stafford
Courses Plus Student 4,663 PointsCreate a dictionary with the following key value pairs: 1) key: 'name', value: '', 2) key: 'topic', value: 'python'. Ass
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.
student = {'name':''}
student = {'topic':'python'}
print(student())
2 Answers
Miranda Chen
6,945 PointsPut it all under the student variable. By the way for the value for 'name', it wants you to make " the value Like this:
student = {'name': '"', 'topic' : 'python'}
Greg Heffley
6,371 Pointsstudent = {
"name" : "",
"topic" : "python"
}
You created a dictionary and then reassigned it with a new dictionary.
Just put them both into the same variable.
Instead of calling print students like a function. ex (your print function), call it like a variable. ex (print(student))
In this example, you do not even need the print function.
Gregory St. Clair
Courses Plus Student 2,001 PointsGregory St. Clair
Courses Plus Student 2,001 PointsHey there :)
You've got a few things sideways here.
first, you assigned student twice, which means student in this case is only a dictionary that contains the topic:python key value pair - because you assigned over it in your code.
What you are looking to do is this: student = { 'name':'', 'topic':'python' }
Do you see how both key value pairs are in the same dictionary, separated by a comma? Next, to call it: print(student)
since student is already declared.