on pcif all else failsthere is always the trusty reset button on your computer the best idea is to avoid writing infinite loops in the first place common loop patterns interactive loops one good use of the indefinite loop is to write interactive loops the idea behind an interactive loop is that it allows the user to repeat certain portions of program on demand let' take look at this loop pattern in the context of our number averaging problem recall that the previous version of the program forced the user to count up how many numbers there were to be averaged we want to modify the program so that it keeps track of how many numbers there are we can do this with another accumulator--call it count--that starts at zero and increases by each time through the loop to allow the user to stop at any timeeach iteration of the loop will ask whether there is more data to process the general pattern for an interactive loop looks like thisset moredata to "yeswhile moredata is "yesget the next data item process the item ask user if there is moredata combining the interactive loop pattern with accumulators for the sum and count yields this algorithm for the averaging programinitialize sum to initialize count to set moredata to "yeswhile moredata is "yesinput numberx add to sum add to count ask user if there is moredata output sum count notice how the two accumulators are interleaved into the basic structure of the interactive loop here is the corresponding python programaverage py def main()sum count