packing and unpacking of sequences python provides two additional conveniences involving the treatment of tuples and other sequence types the first is rather cosmetic if series of comma-separated expressions are given in larger contextthey will be treated as single tupleeven if no enclosing parentheses are provided for examplethe assignment data results in identifierdatabeing assigned to the tuple ( this behavior is called automatic packing of tuple one common use of packing in python is when returning multiple values from function if the body of function executes the commandreturn xy it will be formally returning single object that is the tuple (xyas dual to the packing behaviorpython can automatically unpack sequenceallowing one to assign series of individual identifiers to the elements of sequence as an examplewe can write abcd range( which has the effect of assigning = = = and = as those are the four values in the sequence returned by the call to range for this syntaxthe right-hand side expression can be any iterable typeas long as the number of variables on the left-hand side is the same as the number of elements in the iteration this technique can be used to unpack tuples returned by function for examplethe built-in functiondivmod(ab)returns the pair of values ( /ba bassociated with an integer division although the caller can consider the return value to be single tupleit is possible to write quotientremainder divmod(abto separately identify the two entries of the returned tuple this syntax can also be used in the context of for loopwhen iterating over sequence of iterablesas in for xy in ( )( )( ]in this examplethere will be three iterations of the loop during the first passx= and = and so on this style of loop is quite commonly used to iterate through key-value pairs that are returned by the itemsmethod of the dict classas infor kv in mapping items)