Hello. 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.
Anush PoudelPro Student 551 Points
Print 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 Moustahib7,776 Points
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 Divakar5,444 Points
Just don't add 'DONE' to your shopping list. While printing iterate through the list.