Python Using Databases in Python Our Diary App OrderedDict Practice

stage2

Now create an OrderedDict named menu that has the menu items exactly as listed in the comment. Both keys and values will be strings

menu.py
## Menu Items:
# 'n', 'new challenge'
# 's', 'new step'
# 'd', 'delete a challenge'
# 'e', 'edit a challenge'
from collections import OrderedDict
menu = oredeDict(['n', 'new challenge', 's', 'new step', 'd', 'delete a challenge', 'e', 'edit a challenge'])

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,842 Points

couple of issues here.

  1. menu = oredeDict, oredeDict is a misspell word.
  2. You need to group each key value pair into a tuple.
menu = OrderedDict([('n', 'new challenge'), 
                    ('s', 'new step'), 
                    ('d', 'delete a challenge'), 
                    ('e', 'edit a challenge')])

cool I finally did it

from collections import OrderedDict

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

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

You have to have the value in '' or it will say task 1 failed