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 Using Databases in Python Our Diary App OrderedDict Practice

OrderedDict practice

Oops! it looks like task 1 is no longer passing... Balogna.

Challenge in task one is to import OrderedDict from collections Challenge in task two is create an OrderedDict named menu with the keys and values exactly as they are in the comments. Both key and value will be a string.

Where am I wrong?

menu.py
## Menu Items:
# 'n', 'new challenge'
# 's', 'new step'
# 'd', 'delete a challenge'
# 'e', 'edit a challenge'

from collections import OrderedDict

menu = OrderedDict([
    ('n', 'new challenge')
    ('s', 'new step')
    ('d', 'delete a challenge')
    ('e', 'edit a challenge')
])

jk, stupid commas.

Steven Parker
Steven Parker
229,785 Points

You didn't delete the question, do you still want an answer?

1 Answer

try this from collections import OrderedDict

'n', 'new challenge'

's', 'new step'

'd', 'delete a challenge'

'e9, 'edit a challenge'

menu = OrderedDict([ ('n', 'new challenge'), ('s', 'new step'), ('d', 'delete a challenge'), ('e', 'edit a challenge') ])