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

Python Python Collections (2016, retired 2019) Lists Shopping List Take Three

Daniel McFarlin
Daniel McFarlin
5,168 Points

How do I share my workspace code to get help?

I wanna ask where I went wrong on this pretty long bit of code written in workspaces making up the shopping_list_3.py file. Is there a way for me to attach the work to a question so people can actually see the code to help me out and see the error codes popping up? If so that would be great to know.

2 Answers

Check this video on how to make a snapshot. :smile:

:sparkles: :+1: :sparkles:

I hope this helps :grin:

:dizzy: ~Alex :dizzy:

Daniel McFarlin
Daniel McFarlin
5,168 Points

Exactly what I needed. You are the best Alexander! :)

No problem :bowtie:

jason speziale
jason speziale
656 Points

what is wrong with my code

import os Shopping_list = []

def clear_screen(): os.system("cls" if os.name == "int" else "clear") def show_help(): clear_screen() print("\nSeparate each item with comma.") print("Type DONE to quit, SHOW to see the current list, and HELP to get this message.") def add_to_list(item): show_list() if len(shopping_list): position = input ("where should I add {}?\n" "press enter to add to the end of the list\n" "> ".format(item)) else: postion = 0 try: postion = abs(int(position)) except valueError: position = none if position is not none: shopping_list.insert(position-1, item)
else: shopping_list,append(new_item) show_list() def show_list(): clear_screen()

print("here's your list:")

index = 1
for item in Shopping_list:
    print("{}. {}" .format(index,item))
    index += 1

print("-"+10)

show_help()

while True: new_item = input("> ")

if new_item.upper() == 'DONE' or new_item.upper() == 'quit':
    break
elif new_item.upper() == 'HELP':
    show_help()
    continue
elif new_item.upper() == 'SHOW':
    show_list()
    continue
else:
     add_to_list(new_item)

show_list()