performing repetitive tasks in this performing task specific number of times performing task until completion placing one task loop within another ll the examples in the book so far have performed series of steps just one time and then stopped howeverthe real world doesn' work this way many of the tasks that humans perform are repetitious for examplethe doctor might state that you need to exercise more and tell you to do push-ups each day if you just do one push-upyou won' get much benefit from the exercise and you definitely won' be following the doctor' orders of coursebecause you know precisely how many push-ups to doyou can perform the task specific number of times python allows the same sort of repetition using the for statement unfortunatelyyou don' always know how many times to perform task for exampleconsider needing to check stack of coins for one of extreme rarity taking just the first coin from the topexamining itand deciding that it either is or isn' the rare coin doesn' complete the task insteadyou must examine each coin in turnlooking for the rare coin your stack may contain more than one only after you have looked at every coin in the stack can you say that the task is complete howeverbecause you don' know how many coins are in the stackyou don' know how many times to perform the task at the outset you only know the task is done when the stack is gone python performs this kind of repetition using the while statement most programming languages call any sort of repeating sequence of events loop the idea is to picture the repetition as circlewith the code going round and round executing tasks until the loop ends loops are an essential part of application elements such as menus in factwriting most modern applications without using loops would be impossible