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

keep getting indent error when i add the elif, but works fine without it for some reason

shopping_list = []


def show_help():
    #print out instructions
    print("what should we pick up at the store?")
    print("""
Enter 'DONE' to stop adding items to the list.
Enter 'HELP' for this help.
Enter 'SHOW' to see your current list.
    """)

show_help()

while True:
    new_item = input("> ")

    if new_item == "DONE":
        break
    elif new_item == "HELP":
        show_help()
        continue

    shopping_list.append(new_item)



print("Here's your list")

for item in shopping_list:
    print(item)

I cannot figure this out to save my life, i've moved things around, changed things, and i keep getting ```TabError: Inconsistent use of tabs and spaces in indentation.

Steven Parker
Steven Parker
231,236 Points

Please format your code.

Indentation is critical in Python, even when it's not the primary topic as it is here. And to display it correctly you must format your code using the instructions found in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:

2 Answers

I actually figured it out, it was a problem with another line causing that one not to be indented correctly

Steven Parker
Steven Parker
231,236 Points

:+1: Good deal! You could still format your code for posterity. :smile:

BAM! formatted! lol