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!