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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Ben McMahan](https://secure.gravatar.com/avatar/a3f452836f34357aed2300ea37b640ee?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ben McMahan
7,921 PointsHere's my solution
Added a few things, such as checking for the command inputs after they had been converted to uppercase and a friendlier show_list()
# Create a new empty list called shopping_list
shopping_list = []
def add_to_list(item):
"""
Add To List
Adds a new item to the shopping list
:param item: Item to be added
:return:
"""
# Add the item to the list
shopping_list.append(item)
# Notify the user that the item was added and state the number of items in the list currently
print("Added! List has {} {}".format(len(shopping_list), "items" if len(shopping_list) > 1 else "item"))
def show_help():
"""
Show Help
Shows the menu of available commands
:return:
"""
print("What should we pick up at the store?")
# Multiline print statement
print("""
Enter 'DONE' to stop adding items.
Enter 'SHOW' to show the items on the list.
Enter 'HELP' for this help.
""")
def show_list():
"""
Show List
Prints the shopping list to the screen
:return:
"""
shopping_list_length = len(shopping_list)
if shopping_list_length == 0:
print("There are no items on the shopping list. Add one!")
else:
are_is = "are" if shopping_list_length > 1 else "is"
item_items = "items" if shopping_list_length > 1 else "item"
print("There {} {} {} on the shopping list:".format(are_is, shopping_list_length, item_items))
for item in shopping_list:
print(item)
show_help()
# Infinite Loop
while True:
new_item = input("> ")
if new_item.upper() == "DONE":
break
elif new_item.upper() == 'HELP':
show_help()
continue
elif new_item.upper() == 'SHOW':
show_list()
continue
# Call add_to_list with a new item as an argument
add_to_list(new_item)
show_list()
1 Answer
![Rachel KTY Johnson](https://uploads.teamtreehouse.com/production/profile-photos/10542082/micro_MVIMG_20181123_130419.jpg)
Rachel KTY Johnson
Treehouse Project ReviewerNice! I like the additions that you made that would help this app become more user friendly.