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 Continue

shopping list

# make a list to hold on to ur items
shopping_list = []

# print out instructions how to use the app
print("what should we pick up at the shop?")
print("Enter 'DONE' to stop adding items.")

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

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

# add new items to our list
shopping_list.append(new_item )

# print out the list
print("here's your list: ")

for item in shopping_list:
    print(item)

i want my code to print out the list of items but it is refusing

Hi MUZ140259 Juliana Kofi, I've formatted your code to use code blocks. Please refer to the Markdown Cheatsheet (linked under the text box for entering your question/answer/comments) for instructions on how to format code blocks.

1 Answer

Steven Parker
Steven Parker
231,269 Points

Your code looks good, but I can't check your indentation since you didn't blockquote your code. So compare yours to this copy which is blockquoted. Look carefully at the indentation.

shopping_list.py
# make a list to hold onto 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 adding items.")

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

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

    # add new items to our list
    shopping_list.append(new_item)

# print out the list
print("Here's your list:")

for item in shopping_list:
    print(item)

If it's not a spacing error, are you sure you entered DONE at the end (in all caps) to get it to print? As, is, the test is case-sensitive.

I've formatted Juliana's code, and you're correct, it was an indentation error on the line for appending items.