processing data using the while statement you use the while statement for situations when you're not sure how much data the application will have to process instead of instructing python to process static number of itemsyou use the while statement to tell python to continue processing items until it runs out of items this kind of loop is useful when you need to perform tasks such as downloading files of unknown size or streaming data from source such as radio station any situation in which you can' define at the outset how much data the application will process is good candidate for the while statement that is described more fully in the sections that follow understanding the while statement the while statement works with condition rather than sequence the condition states that the while statement should perform task until the condition is no longer true for exampleimagine deli with number of customers standing in front of the counter the salesperson continues to service customers until no more customers are left in line the line could (and probably willgrow as the other customers are handledso it' impossible to know at the outset how many customers will be served all the salesperson knows is that continuing to serve customers until no more are left is important here is how while statement might lookwhile sum the statement begins with the while keyword it then adds condition in this casea variablesummust be less than for the loop to continue nothing specifies the current value of sumnor does the code define how the value of sum will change the only thing that is known when python executes the statement is that sum must be less than for the loop to continue performing tasks the statement ends with colon and the tasks are indented below the statement because the while statement doesn' perform series of tasks set number of timescreating an endless loop is possiblemeaning that the loop never ends for examplesay that sum is set to when the loop beginsand the ending condition is that sum must be less than if the value of sum never increasesthe loop will continue executing forever (or at least until the computer is shut downendless loops can cause all sorts of bizarre problems on systemssuch as slowdowns and even computer freezesso it' best to avoid