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

No matter what I do, it doesn't work

I've been working on this shopping list app and I've checked my code but it doesn't seem to be fixing any of the problems. Here's my code:

shopping_list = [] print("Type in something to add it to the list.") print("To quit type in DONE")

while True: new_item = input("> ")

if new_item == "DONE":
    break

shopping_list.append(new_item)

print("Here's your list")

for item in shopping_list: print(item)

As I posted it the indentation is not right on the post so I will post the link to my workspace.

3 Answers

Not sure if you where able to fix the error's in the code but I had a look and I got it to run.

shopping_list = [] new_item = "" print("Type somthing") print('To quit type "DONE"') if new_item == 'DONE': shopping_list.append(new_item) print("Here is your list") for item in shopping_list.append: print(item)

This is what I used to get it to work.. Hopefully this helps.

Still didn't work. It's not like a syntax error, it just won't return anything to the shell. It just returns to this:treehouse:~/workspace$

I'm not sure if it has to do with my workspace or what but it just refuses to run. I'm clueless?

Hmm it worked and ran fine for me.. have you tried closing down the shell and re opening it to clear everything. Or create a brand new work space. Like close your current one and open a new one without any pages in it.

Yep, tried that but now it's saying 'break is not in loop'. I double checked and it seems to be inside. Still not sure what is wrong with it.

Hmm . That seems odd. I'll have a look again.. Sorry for not being much help. Still learning Python myself. So getting use to it still. If I can help i'll post on here asap.

Thank you for replying anyways:)