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)
![Igor Bochenek](https://secure.gravatar.com/avatar/25d3f46726ebc71750968b4828644fb8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Igor Bochenek
3,960 PointsShopping list 3
shopping_list = []
def show_help(): print("\nSeperate each item with a comma.") print("Type DONE to quit, SHOW to see current list, and HELP to get this message")
def show_list(): count = 1 for item in shopping_list: print("{}: {}".format(count, item)) count += 1
print("Give me the list of things you want to shop for.")
show_help()
show_list()
while True: new_stuff = input("> ")
if new_stuff == "DONE":
print("\nHere is your list:")
show_list()
break
elif new_stuff == "SHOW":
show_list()
continue
elif new_stuff == "HELP":
show_help()
continue
else:
new_list = new_stuff.split(",")
index = input("\nAdd this at a certain spot? \nPress enter to close,"
"or give me a number. \nCurently {} items in the list".format(len(shopping_list)))
if index:
spot = int(index) - 1
for item in new_list:
shopping_list.insert(spot, item.strip())
spot += 1
else:
for item in new_list:
shopping_list.append((item.strip()))
ValueError: invalid literal for int() with base 10: 'DONE'
2 Answers
![Igor Bochenek](https://secure.gravatar.com/avatar/25d3f46726ebc71750968b4828644fb8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Igor Bochenek
3,960 Pointswhat am i doing wronf ?
![Brian Zhang](https://secure.gravatar.com/avatar/2f80c913d9a788c4031bb76c1b1235f9?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Brian Zhang
975 PointsI noticed a few things, When you enter something other than a number, at this part of your code spot = int(index) - 1, it would try to convert it to a number and that's where you would get the ValueError, you want to do a try except to catch the value error.
Also at the end it, you should also increment spot when you append a new item to the list. hope that helps.