Multiple Assignment in the Python
Categories: Python
Python allows you to assign a single value to several variables simultaneously.
For example
a = b = c = 1
Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables.
For example −
a,b,c = 10,20,"Priya"
Here, two integer objects with values 10 and 20 are assigned to variables a and b respectively, and one string object with the value "Priya" is assigned to the variable c.