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
gurinder singh
Courses Plus Student 1,422 PointsNot showing the list
make a list to hold our items
shopping_list = []
def help(): #print out instructions(help) print("Type HELP for instruction.") print("Type SHOW to see list.") print("Type DONE to quit program: ") def show(): #print out the list(show) print("your shopping list is: ") for item in shopping_list: print(item)
def add_item(shoping_list, new_item):
#add new items
shopping_list.append(new_item)
print("Added {} to shopping list! List now has {} items".format(item, len(shopping_list)))
return shopping_list
def main(): help() while True:
#ask for new items
new_item = input("add a item: ")
if new_item == 'HELP':
help()
continue
#be able to quit program(done)
elif new_item == 'DONE':
show()
break
elif new_item == 'SHOW':
show()
continue
main()
Steven Parker
243,656 PointsUse the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area.
Or watch this video on code formatting.
gurinder singh
Courses Plus Student 1,422 Pointsgurinder singh
Courses Plus Student 1,422 Pointsmake a list to hold our items
shopping_list = []
def help(): #print out instructions(help) print("Type HELP for instruction.") print("Type SHOW to see list.") print("Type DONE to quit program: ") def show(): #print out the list(show) print("your shopping list is: ") for item in shopping_list: print(item)
def add_item(shoping_list, new_item):
def main(): help() while True:
main()