example this program will add up the numbers from to the way this works is that each time we encounter new numberwe add it to our running totals for in range( , ) print'the sum is 'sexample this program that will ask the user for numbers and then computes their average for in range( )num eval(input'enter number') num print'the average is ' / example common use for summing is keeping score in game near the beginning of the game we would set the score variable equal to then when we want to add to the score we would do something like belowscore score swapping quite often we will want to swap the values of two variablesx and it would be tempting to try the followingx but this will not work suppose is and is the first line will set to which is goodbut then the second line will set to also because is now the trick is to use third variable to save the value of xhold hold in many programming languagesthis is the usual way to swap variables pythonhoweverprovides nice shortcutx, , we will learn later exactly why this works for nowfeel free to use whichever method you prefer the latter methodhoweverhas the advantage of being shorter and easier to understand