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 Collections (2016, retired 2019) Lists Removing Items From A List

How is he ending the script?

I just noticed that he is using "break" to break the loop, but then it ends the script.

1 Answer

Nathan,

The whole program runs within the while loop. As long as the user selects HELP, SHOW, REMOVE, or types a new item, we stay in the while loop. Since the while boolean is set to "True," the only way to leave the loop is to execute a "break." When that happens, the loop is exited permanently leaving only the final "show_list()" call on the last line of the script. Since this is the last line, the script has ended. Hope this helps.