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 trialAaron Munday
334 PointsMy help function is being added to the list
My help function is being added to the list and will not work as a function.
make a list to hold onto our items
shopping_list = []
def show_help = (): # print out intstructions on how to use the app print("what should we get at the store?") print(""" Enter 'DONE' to stop adding items. Enter 'HELP' for this help Enter 'SHOW' to see your current list. """)
show_help()
while True: # ask for new items new_item = input("> ") # be able to quit the app if new_item == "DONE": break elif new_item == "HELP": show_help() continue
add new items to list
shopping_list.append(new_item)
print out the list
print("Here's your list:") for item in shopping_list: print(item)
1 Answer
Steven Parker
231,271 PointsIt's hard to read without formatting, but I spotted this line which appears to have a stray equal sign in it:
def show_help = ():
There should not be anything between the function name and the parentheses.
When posting code in future quesitons, always use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. Or watch this video on code formatting.
Aaron Munday
334 PointsAaron Munday
334 PointsThank you