Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Break

Sean Frye
Sean Frye
1,167 Points

I have been trying this for over a half hour

I have been trying this for over half an hour. I have looked through many of the notes I have taken and I have tried entering different commands and different iterations for this loopy function and I just keep getting stuck. It feels like what I have studied isn't helping here or I am missing something and just not understanding it.

breaks.py
def loopy(items):
    items = []

print("What do you need?")
print("Enter 'DONE' to stop adding items.")

while True:
    new_item = input("> ")

    if new_item == 'DONE':
        break

    items.append(new_item)

print("Here's your list.")

for item in items:
    print(item)

1 Answer

Rich Donnellan
Rich Donnellan
25,767 Points

Sean,

The challenge is a very simplified version of the previous video. Do exactly as the instructions say; nothing more, nothing less.

Hint: Omit everything between the first line and the start of the for loop. Then in task 2, you'll do a check with an if statement.

Sean Frye
Sean Frye
1,167 Points

Wow! I just tried what you said and it worked. But the thing that frustrates me is that I could have sworn I already tried that, but apparently I must have left something out. Hm. I wouldn't say it's exactly the same. It seemed different to me, although I am seeing some similarities between the correct answer and the notes I took from the video itself.

Rich Donnellan
Rich Donnellan
25,767 Points

Glad you got it!

Try not to get frustrated. Really. Just be very mindful of what the challenges are asking for. TH requires pretty specific answers and anything extra will cause a bummer, even though it's technically correct.