Additional features are discussed in this article.

** 1. setitem (ob, pos, val) **: — This function is used to ** assign ** a value at a ** specific position ** in a container.

Operation — ** ob [pos] = val **

** 2. delitem (ob, pos) **: — This function is used to ** remove ** a value at a ** specific position ** in a container.

Operation — ** del ob [pos] **

** 3. getitem (ob, pos) **: — This function is used to ** access ** to a value at a ** specific position ** in a container.

Operation — ** Ob [pos] **

```
``` |

Output:

The original list is: 1 5 6 7 8 The modified list after setitem () is: 1 5 6 3 8 The modified list after delitem () is: 1 6 3 8 The 4th element of list is: 8

** 4. setitem (ob, slice (a, b), vals) **: — This function is used to ** set values within a specific range ** in a container.

Operation — ** obj [a: b] = vals **

** 5. delitem (ob, slice (a, b)) **: — this function is used to ** remove values from a specific range ** in a container.

Operation — ** del obj [a: b] **

** 6. getitem (ob, slice (a, b)) **: — this function is used to ** access values within a specific range ** in a container.

Operation — ** object [a: b] **

```
``` |

Output:

The original list is: 1 5 6 7 8 The modified list after setitem () is: 1 2 3 4 8 The modified list after delitem () is: 1 2 8 The 1st and 2nd element of list is: [1, 2]

** 7. concat (ob1, obj2) **: — This function is used to ** merge ** two containers.

Operation — ** obj1 + obj2 **

** 8. contains (ob1, obj2) **: — This function is used to ** check for obj2 in obj1 **.

Operation — ** obj2 in obj1 **

```
``` |

Output:

The concatenated string is: pythonengineering geeksfor contains geeks

** 9. and_ (a, b) **: — This function is used to evaluate the ** bitwise and ** referenced arguments.

Operation — ** a & amp; b **

** 10. or_ (a, b) **: — This function is used to evaluate the ** bitwise or ** of the mentioned arguments.

Operation — ** a | b **

** 11. xor (a, b) **: — This function is used to compute the ** bitwise xor ** of the arguments mentioned.

Operation — ** a ^ b **

** 12. invert (s) **: — This function is used to calculate the ** bitwise inversion ** of the mentioned argument.

Operation — ** ~ a **

```
``` |

Output:

The bitwise and of a and b is: 0 The bitwise or of a and b is: 1 The bitwise xor of a and b is: 1 The inverted value of a is: 1

This article courtesy of ** Manjit 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.

Please post comments if you find anything wrong or if you would like to share more information on the topic discussed above.

X
# Submit new EBook