You can even assign multiple values to multiple variables in a single line

>>> a , b = 45, 54
>>> a
45
>>> b
54
Copy the code

This technique is handy for swapping the values of two numbers

>>> a, b = b , a
>>> a
54
>>> b
45
Copy the code

To see how this works, you need to study the tuple data type. We create tuples with commas. On the right side of the assignment we create a tuple, which we call tuple packing. On the left side of the assignment we do tuple unpacking.

Here is another example of tuple unpacking:

>>> data = ("shiyanlou", "China", "Python")
>>> name, country, language = data
>>> name
'shiyanlou'
>>> country
'China'
>>> language
'Python'
Copy the code