line item 'red'red'red'orange'orange'orange'yellow'yellow'yellow'green'green'green'greennumber comment set items to ['red''orange','yellow''green'start with item as first in sequence print red + on to the next element in sequence print orange = + on to the next element in sequence print yellow = + on to the last element in sequence print green = + sequence doneend loop and code the final value of number is never usedbut that is ok what we want gets printed go through carefully and be sure you understand the meaning of each entry in the tableand the reason for the sequencing and the reason for the exact position of each entry in each step where it changesin particular see how and why the line number for each successive row is not always one more than the previous row in particularsee how the same sequence of numbered lines may be repeated in multiple places in the table without this understanding you will not be able to play computer yourself and really understand loops this short example illustrates lot of ideas important to loopsloops may contain several variables one way variable can change is by being the variable in for loop headingthat automatically goes through the values in the for loop list another way to have variables change in loop is to have an explicit statement that changes the variable inside the loopcausing successive modifications there is general pattern to loops with successive modification of variable like number above the variables to be modified need initial values before the loop (line in the example above the loop heading causes the repetition in for-loopthe number of repetitions is the same as the size of the list the body of the loop generally "does something(like print above in line that you want done repeatedly there is code inside the body of the loop to set up for the next time through the loopwhere the variable which needs to change gets transformed to its next value (line in the example abovethis information can be put in code outlineinitialize variables to be modified loop heading controlling the repetitiondo the desired action with the current variables modify variables to be ready for the action the next time if you compare this pattern to the for-each and simple repeat loops in basic for loops (page )you see that the examples there were simpler there was no explicit variable modification needed to prepare for the next time though the loop we will refer to the latestmore general pattern as successive modification loop beginning with python