Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

why is this not working

shopping_list = []

def show_help(): print("what should we pick up at the store?") print(""" Enter 'Done' to stop adding items.
Enter 'Show' to see what is currenly on your list. Enter 'Help' for this help. """)

while True:

ask for new item

new_item = input(">")

if new_item == 'Done':
    break
elif new_item == 'Help':
    show_help()
    continue 


shopping_list.append(new_item)

be able to quit the app

print out the list

print("Here is your list")

for item in shopping_list: print(item)

2 Answers

Did you try changing:

shopping_list.append(new_item)

to:

else:
    shopping_list.append(new_item)
Anurag k
Anurag k
902 Points

if you use elif you should definitely use else at the last

James Correnti
James Correnti
731 Points

That should not matter in this case, since he is using continue and break in the if and elif