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 Basics (Retired) Shopping List Shopping List Project

Corey Hayden
Corey Hayden
11,717 Points

Why is 'continue' needed in shopping_list.py?

In the initial version of 'shopping_list,' why is continue needed when the state of the loop is still True and there is no steps to skip? It seems to work fine without 'continue'.

1 Answer

Hi Corey,

continue isn't needed when it's the last statement in a loop. I think Kenneth at some point had said he only put it in there to be explicit about it.

It would only really be needed somewhere in the middle of your loop if you wanted to continue looping but be able to skip over the rest of the code in your loop.