'''fancier -string example for formatting'' sum prod print( '{ { {sum}{ { {prod'see the directly before the literal format string automatically substituting local variable values quotient string dictionary exercise create quotientdict py by modifying quotientreturn py in quotient string return exercise (page so that the quotientstring function accomplishes the same thingput local variable names inside the braces of format stringand either process the format string by appending format(**locals()or else make the format string into an -string if you use meaningful names for the variablesthe format string should be particularly easy to understand loops and sequences modern computers can do millions or even billions of instructions second with the techniques discussed so farit would be hard to get program that would run by itself for more than fraction of second practicallywe cannot write millions of instructions to keep the computer busy to keep computer doing useful work we need repetitionlooping back over the same block of code again and again there are two python statement types to do thatthe simpler for loopswhich we take up shortlyand while loopswhich we take up laterin while statements (page two preliminaries the value of already defined variables can be updated this will be particularly important in loops to prepare for that we first follow how variables can be updated in an even simpler situationwhere statements are just executed in textual order sequence types are used in for loops we will look at basic sequence typelist then we put this all together this is long section go slowly and carefully updating variables the programs so far have defined and used variablesbut other than in early shell examples we have not changed the value of existing variables for now consider particularly simple examplejust chosen as an illustrationin the example file updatevar py simple sequential code updating two variables * print(xycan you predict the resultrun the program and check particularly if you did not guess rightit is important to understand what happensone step at time that means keeping track of what changes to variables are made by each statement in the table belowstatements are referred to by the numbers labeling the lines in the code above we can track the state of each variable after each line is executed dash is shown where variable is not defined for instance after loops and sequences