Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

my code is not working

make a list to hold our items

shopping_list = {}

print out instructions on how to use the app

print("What should we pick up at the store?") print ("Enter 'DONE' to stop the adding items.")

while True: #ask for new items new_item = input("> ")

# be able to quit the app
if new_item == 'DONE':

#add new items to our list

print out the list

print("Here's your list:")

for item in shopping_list: print(item)

what's wrong with the code!!!! it keeps giving me an AttributeError at the shopping_list.append saying 'dict' object has no attribute 'append' what does this mean. plz help thank you

2 Answers

Yipeng Wang
Yipeng Wang
3,211 Points

Hi Ayub

Here is it , this was how you define the list shopping_list = {}, "{}" defines a dictionary rather than a "list" , that's why you got a AttributeError , a dictionary variable does not have the append() function you should change it to shopping_list = []


Yes Thanks You Very Much That makes sense!