2.4  Sequence assignment:
In recent version of Python, tuple and list assignment have been generalized into instances of what we now call sequence assignment.
Python assigns items in the sequence on the right to variables in the sequence on the left by position.Sequence assignment assign values from left to right and assigns the values one at a time.


# python script for sequence assignment
a, b, c,d,e,f = 'Python'
print('a = ', a)
print('b = ', b)
print('c = ', c)
print('d = ', c)
print('e = ', c)
print('f = ', c)

OUTPUT:
a = P
b = y
c = t
e=h
e=o
f=n



2.5  Extended Sequence unpacking:
It allows us to be more flexible in how we select portions of a sequence to assign.If we use the star operator(*), it’s possible to have different numbers of elements on each side of the assignment operator. The starred variable will be assigned a list with all the leftovers that were not assigned to the other variables. There may be only one starred variable:

p, *q = 'Python Programming'
print('p = ', p)
print('q = ', q)
Here, p is matched with the first character in the string on the right and q with the rest. The starred name (*q) is assigned a list, which collects all items in the sequence not assigned to other names.
OUTPUT:
p = P
q = ['y', 't', 'h', 'o','n',' ','P','r','o','g','r','a','m','m','i','n',g']
This is especially handy for a common coding pattern such as splitting a sequence and accessing its front and rest part.


2.6 Multiple- target assignment:
x = y = 75
print(x, y)
In this form, Python assigns a reference to the same object (the object which is rightmost) to all the target on the left.
OUTPUT
75 75



2.7 Augmented assignment :
The augmented assignment is a shorthand assignment that combines an expression and an assignment.

x = 2
# equivalent to: x = x + 1
x += 1
print(x)
OUTPUT
3
There are several other augmented assignment forms: -=, **=, &=, etc.

Previous Topic:-->> Constants in Python || Next topic:-->>Input/Output in Python