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 (2015) Shopping List App Shopping List Introduction

Idan shami
Idan shami
13,251 Points

I don't understand why 'DONE' is infinite...

I understand that new_itme, for example, is infinite because you can add always more items, and you don't have a limit for how many items you put on the list.

But 'DONE' is not infinite, you can not write DONE many times, only 1 time... maybe this question is kind of stupid but if you have an example it will help a lot...

Thank you, Idan.

Idan shami
Idan shami
13,251 Points

watch the video ^ to know what i am talking about P: Thanks.

2 Answers

Nazim Mohamed
Nazim Mohamed
1,014 Points

DONE isn't infinite you can only enter it once and the the code stops using the BREAK

Idan shami
Idan shami
13,251 Points

so why he is indented to the while loop?

Nazim Mohamed
Nazim Mohamed
1,014 Points

It is indented in the loop so that it is checked for everytime the loop runs, but the moment the DONE is inputted the BREAK stops the code regardless of it being in the loop.