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
alekseibingham
4,491 PointsCant figure out this syntax error for the life of me, even used notepad++'s feature to see indentations and spaces!
make a list to hold onto items
shopping_list = []
print("What should we pick up at the store?")
def show_help(): # print out instructions on how to use app print(""" Enter 'DONE' to stop adding items. Enter 'HELP' to view available commands. ENTER 'SHOW' to view your current list. """)
def show_list(): # print out the list print("Here's your list:")
for item in shopping_list:
print(item)
def add_to_list(new_item): # add new items to our list shopping_list.append(new_item) print("Added {}. List now has {} items.".format(new_time, len(shopping_list))
show_help()
while True: # ask for new item new_item = input("> ")
# SHOW Command
if new_item == "SHOW":
print(shopping_list)
new_item = input("> ")
# be able to quit the app
if new_item == "DONE":
break
elif new_item == "HELP":
show_help()
continue
elif new_time == "SHOW":
show_list()
continue #continues loop
add_to_list(new_item)
show_list()
2 Answers
alekseibingham
4,491 PointsSOLVED, for anyone who needs it. At the end of my def add_to_list(new_item): # add new items to our list shopping_list.append(new_item) print("Added {}. List now has {} items.".format(new_time, len(shopping_list)) i only have 2 closing parenthesis, as you can tell.... i need 3.
Ari Misha
19,323 PointsHiya Aleksei! Your "show_help()" method shows help for your "DONE", "HELP" and "SHOW" command. I think your show_help() needs to be inside of your "While" loop, just above your "new_item" variable. Try this and it may or may not work ? If not, lemme know what kinda error its showing on the screen. But code seems alright to me.
alekseibingham
4,491 Pointsalekseibingham
4,491 Pointscant get it to just paste over properly, still new to treehouse. The error occurs at "show_help" just beneth the def add_to_list(new_time)... If i remove this add_to_list the error goes away, but why?