Python Using Databases in Python Our Diary App Switching It Up

Dara Roberts
PRO
Dara Roberts
Pro Student 3,186 Points

Name error persisting after moving OrderedDict to the bottom of file

After moving the OrderedDict to the bottom of the file

menu = OrderedDict([
    ('a', add_entry),
    ('v', view_entry),
])

if __name__ == '__main__':
    initialize()
    menu_loop()

My command line returns this error:

Action: a
Traceback (most recent call last):
  File "diary.py", line 56, in <module>
    menu_loop()
  File "diary.py", line 31, in menu_loop
    choice = input('Action: ').lower().strip()
  File "<string>", line 1, in <module>
NameError: name 'a' is not defined