Python Python Basics (2015) Shopping List App Shopping List Introduction

steven breidenstein
steven breidenstein
2,094 Points

AttributeError

treehouse:~/workspace$ python shopping_list.py
What should we pick up at the store?
Enter 'DONE' to stop adding items.

apple
Traceback (most recent call last):
File "shopping_list.py", line 13, in <module>
shopping_list.append(new_item)
AttributeError: 'dict' object has no attribute 'append'
my code looks identical to the one in the video so i don't know whats going on

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 56,833 Points

Did you accidentally define shopping_list as a dict:

# define it as a list using square brackets
shopping_list = []
# define it as a dict using curly brackets or braces
shopping_list = {}