# In-Place Operators in Python | Set 2 (ixor (), iand (), ipow (), …)

File handling | Python Methods and Functions

1. ixor () : — This function is used to assign and change the current value . This operation performs the operation " a ^ = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

2. ipow () : — This function is used to assign and exponentiate the current value . This operation performs the operation " a ** = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

 ` # Python code to demonstrate how it works ` ` # ixor () and ipow () `   ` # import statement to handle statement operations ` ` import ` ` operator `   ` # using ixor () to exclude or and assign a value ` ` x ` ` = ` ` operator.ixor (` ` 10 ` `, ` ` 5 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after xoring and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `   ` # using ipow () to exponentiate and assign a value ` ` x ` ` = ` ` operator.ipow (` ` 5 ` `, ` ` 4 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after exponentiating and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `

Output:

` The value after xoring and assigning: 15 The value after exponentiating and assigning: 625 `

3. iand () : — this function is used to assign both bitwise and current values ​​. This operation performs the operation “ a & amp; = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

4. ior () : — This function is used to assignment and bitwise or current value . This operation performs the operation “ a | = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

 ` # Python code to demonstrate how it works ` ` # ior () and iand () `   ` # import statement to handle statement operations ` ` import ` ` operator `   ` # using ior () for or, and assign a value ` ` x ` ` = ` ` operator.ior (` ` 10 ` `, ` ` 5 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after bitwise or, and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `   ` # using iand () for and, and assign a value ` ` x ` ` = ` ` operator.iand (` ` 5 ` `, ` ` 4 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after bitwise and, and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `

Output:

` The value after bitwise or, and assigning: 15 The value after bitwise and, and assigning: 4 `

5. ilshift () : — this function is used to assign and bitwise shift the current value by the second argument . This operation performs the operation " a & lt; & lt; = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

6. irshift () : — This function is used to assign and bitwise offset the rights of the current value as the second argument . This operation performs the operation " a & gt; & gt; = b ". The not assignment is true for immutable containers such as strings, numbers, and tuples.

 ` # Python code to demonstrate how it works ` ` # ilshift () and irshift () `   ` # import statement to handle statement operations ` ` import ` ` operator `   ` # using ilshift () to shift left and assign value ` ` x ` ` = ` ` operator.ilshift (` ` 8 ` `, ` ` 2 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after bitwise left shift and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `   ` # use irshift () to bitwise shift right and assign a value ` ` x ` ` = ` ` operator.irshift (` ` 8 ` `, ` ` 2 ` `); `   ` # print the changed value ` ` print ` ` (` ` "The value after bitwise right shift and assigning:" ` `, end ` ` = ` ` "") ` ` print ` ` (x) `

Output:

` The value after bitwise left shift and assigning: 32 The value after bitwise right shift and assigning: 2 `

Next article — at Manjeet Singh . If you are as Python.Engineering and would like to contribute, you can also write an article using contribute.python.engineering or by posting an article contribute @ python.engineering. See my article appearing on the Python.Engineering homepage and help other geeks.