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 Basics (2015) Shopping List App Shopping List Introduction

michael ventura
michael ventura
1,260 Points

when i break on "DONE".... puts DONE is at the end of my list?

my list runs great.. breaks program when DONE is announced..yet DONE is put at end of my list. code looks the same. help

if new_task == "DONE": break

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Unfortunately, you haven't posted all of your code so I'm going to have to make an educated guess here. My guess is that your code looks a bit like this:

shopping_list.append(new_item)

if new_item == 'DONE':
  break

If this is the case, then the order needs to be reversed. You need to first check for "DONE" and break before it can be added to the list:

if new_item == 'DONE':
  break

shopping_list.append(new_item)

Hope this helps! :sparkles: