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 trialTrenton Cain
550 PointsHello. When iterating through my for loop, I would like to not print out the the DONE option.
I have tried continue, to remove the done option in my printed list... Please advise.
3 Answers
Anush Poudel
Courses Plus Student 551 PointsPrint out the list items after you've iterated through the loop. Or maybe check the item if it is "DONE" and break the loop before you're printing things. It would be nice if you'd show your code for more detailed explanation.
Youssef Moustahib
7,779 PointsHi,
Firstly, you need to indent this properly as you have only given it two spaces:
for item in todo_list: print(item)
Secondly, you need to indent the append part of the code into the while loop, so it should be:
while True: # ask for new items new_item = input("> ")
# be able to quit the app
if new_item == 'DONE':
break
# add new item to our list
todo_list.append(new_item)
Tilak Muruduru Divakar
6,459 PointsJust don't add 'DONE' to your shopping list. While printing iterate through the list.
STEVEN PENA
13,928 PointsSTEVEN PENA
13,928 Pointsam having the same problem
make a list to hold our items