# Assignment Operators

The Assignment operators in python are
1. Assignment operator (=)
3. Subtract and assign (-=)
4. Multiply and assign (*=)
5. Divide and assign (/=)
6. Modulus and assign (%=)
7. Floor Division and assign (//=)
8. Exponent and assign (**=)

### Assignment operator

Assignment operator assigns value of the right operand to the left variable.

```a=10
b=20
a=b
print('The value of a after assigning b',a)
```
output
```The value of a after assigning b 20
```

Add and assign operator adds the value of the right operand with left and stores result in the left variable.

```a=10
b=20
a+=b
print('The value after add and assign is',a)
```
output
```The value after add and assign is 30
```

### Subtract and assign

Subtract and assign subtract the right operand from the operand on the left and stores the result in the left variable.

```a=10
b=30
b-=a
print('The value of b after Subtract and assign is',b)
```
output
```The value of b after Subtract and assign is 20
```

### Multiply and assign

Multiply and assign multiply the left operand with the right operand and stores in the left variable.

```a=5
b=6
a*=b
print('The value of a after multiply and assign is',a)
```
output
```The value of a after multiply and assign is 30
```

### Divide and assign

Divide and assign divides the left operand with the right operand the division operation returns the quotient. The result is stored in the left variable.

```a=35
b=7
a/=b
print('The value of a after division and assign is',a)
```
output
```The value of a after division and assign is 5.0
```

### Modulus and assign

Modulus and assign operator divides the left operand with the right operand. The modular division returns the remainder as the result. The result is stored in the left variable.

```a=62
b=8
a%=b
print('The value of a after modular division and assign',a)
```
output
```The value of a after modular division and assign 6
```

### Floor division and assign

Floor division divides the left operand with the right operand and returns the result by removing the decimal part in the result and the result is stored in the left variable.

```a=37
b=2
a//=b
print('The value of a after floor division and assign',a)
```
output
```The value of a after floor division and assign 18
```

### Exponent and assign

Exponent and assign does the exponential calculation of the left operand with the right operand and stores the result in the right operand.
```a=2
b=5
a**=b
print('The value of a after exponent and assign',a)
```
output
```The value of a after exponent and assign 32
```

More

More

More

More

More

More
Top