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 trialRussell Alson
Courses Plus Student 1,297 PointsHow do you clear what was written after I enter 'DONE'?
After I enter 'DONE' how can I have the program erase what I have written before it prints the list?
1 Answer
Jay Meyer
7,708 PointsHey Russell,
If you want it to empty the list and have it not print anything after you type 'DONE', then just reassign the list variable to = an empty list. So right now it prints everything that you have entered into the list when you type 'DONE', but if you change your code to
if new_item == 'DONE':
shopping_list = []
break
shopping_list.append(new_item)
then it will assign shooping_list back to an empty list and print that.