the example code demonstrates the three tasks you must perform when working with while loop in straightforward manner it begins by setting sum to which is the first step of setting the condition environment the condition itself appears as part of the while statement the end of the while code block accomplishes the third step of coursethe code displays the current value of sum before it updates the value of sum while statement provides flexibility that you don' get with for statement this example shows relatively straightforward way to update sum howeveryou can use any update method required to meet the goals of the application nothing says that you have to update sum in specific manner in additionthe condition can be as complex as you want it to be for exampleyou can track the current value of three or four variables if so desired of coursethe more complex you make the conditionthe more likely it is that you'll create an endless loopso you have practical limit as to how complex you should make the while loop condition choose runrun module python executes the while loop and displays the numeric sequence shown in figure - figure - the simple while loop dis plays sequence of numbers nesting loop statements in some casesyou can use either for loop or while loop to achieve the same effect the manners work differentlybut the effect is the same in this exampleyou create multiplication table generator by nesting while loop within for loop because you want the output to look niceyou use little formatting as well provides you with detailed instruction in this regardthis example also appears with the downloadable source code as forelse py