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
STAFF
Jennifer Nordell
Treehouse Staff

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: