simultaneous assignment there is an alternative form of the assignment statement that allows us to calculate several values all at the same time it looks like thisthis is called simultaneous assignment semanticallythis tells python to evaluate all the expressions on the right-hand side and then assign these values to the corresponding variables named on the left-hand side here' an examplesumdiff +yx- here sum would get the sum of and and diff would get the difference this form of assignment seems strange at firstbut it can prove remarkably useful here' an examplesuppose you have two variables and and you want to swap the values that isyou want the value currently stored in to be in and the value that is currently in to be stored in at firstyou might think this could be done with two simple assignments this doesn' work we can trace the execution of these statements step-by-step to see why suppose and start with the values and let' examine the logic of the program to see how the variables change the following sequence uses comments to describe what happens to the variables as these two statements are executedvariables initial values now final see how the first statement clobbers the original value of by assigning to it the value of ywhen we then assign to in the second stepwe just end up with two copies of the original value one way to make the swap work is to introduce an additional variable that temporarily remembers the original value of temp temp let' walk-through this sequence to see how it works