wellthat wasn' too bad knowing couple of common patternscounted loop and accumulatorgot us to working program with minimal difficulty in design and implementation hopefullyyou can see the worth of committing these sorts of programming cliches to memory indefinite loops our averaging program is certainly functionalbut it doesn' have the best user interface it begins by asking the user how many numbers there are for handful of numbers this is okbut what if have whole page of numbers to averageit might be significant burden to go through and count them up it would be much nicer if the computer could take care of counting the numbers for us unfortunatelyas you no doubt recallthe for loop (in its usual formis definite loopand that means the number of iterations is determined when the loop starts we can' use definite loop unless we know the number of iterations ahead of timeand we can' know how many iterations this loop needs until all of the numbers have been entered we seem to be stuck the solution to this dilemma lies in another kind of loopthe indefinite or conditional loop an indefinite loop keeps iterating until certain conditions are met there is no guarantee ahead of time regarding how many times the loop will go around in pythonan indefinite loop is implemented using while statement syntacticallythe while is very simple while here condition is boolean expressionjust like in if statements the body isas usuala sequence of one or more statements the semantics of while is straightforward the body of the loop executes repeatedly as long as the condition remains true when the condition is falsethe loop terminates figure shows flowchart for the while notice that the condition is always tested at the top of the loopbefore the loop body is executed this kind of structure is called pre-test loop if the loop condition is initially falsethe loop body will not execute at all here is an example of simple while loop that counts from to while < print(ii this code will have the same output as if we had written for loop like thisfor in range( )print(