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 trialByron Tollison
9,942 Pointskeep 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.
2 Answers
Byron Tollison
9,942 PointsI actually figured it out, it was a problem with another line causing that one not to be indented correctly
Steven Parker
231,275 PointsGood deal! You could still format your code for posterity.
Byron Tollison
9,942 PointsBAM! formatted! lol
Steven Parker
231,275 PointsSteven Parker
231,275 PointsPlease 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.