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 the values in a particular range in the container.
Operation – obj[a:b] = vals
5. delitem(ob, slice(a,b)) :- This function is used to delete the values from a particular range in the container.
Operation – del obj[a:b]
6. getitem(ob, slice(a,b)) :- This function is used to access the values in a particular range in the container.
Operation – obj[a:b]
python - Sample - python code :
python tutorial - 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 concatenate two containers.
Operation – obj1 + obj2
8. contains(ob1,obj2) :- This function is used to check if obj2 in present in obj1.
Operation – obj2 in obj1
python - Sample - python code :
python tutorial - Output :
The concatenated string is : wikitechy
wiki contains techy
9. and_(a,b) :- This function is used to compute bitwise and of the mentioned arguments.
Operation – a & b
10. or_(a,b) :- This function is used to compute bitwise or of the mentioned arguments.
Operation – a | b
11. xor(a,b) :- This function is used to compute bitwise xor of the mentioned arguments.
Operation – a ^ b
12. invert(a) :- This function is used to compute bitwise inversion of the mentioned argument.
Operation – ~ a
python - Sample - python code :
python tutorial - 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
Wikitechy tutorial site provides you all the learn python , python 3 online course , python scripting training , python training ,
python online course , learning with python , python programming training , learn python programming for beginners , learn python
course , free online courses for python , courses in python
Related Searches to Operator Functions in Python | Part 2
python module operatorpython binary operatorsin operator pythonmodulo operator pythonpython logical operatorspython equality operatorspython mathematical operatorspython exponent operatorpython if and operatorpython list operatorscomparison operators pythonpython relational operatorspython list operatorpython basic operatorspython operator listpython if operatorpython like operatorpython operators list& operator pythonpython or operatormath operators pythonoverloading operators pythonrelational operators pythonarithmetic operators pythonpython operator stringoperator in pythonremainder operator pythonpython modulo operator examplepython triple operatorpython boolean operatorspython conditional operatorpython math operators listpython print operatorset operators pythonpython shift operatorpython operator not equalif operator pythonboolean operators pythonlogical operators pythonand operator in pythonlogical operators in pythonpython hat operatorpython modulus operatorbitwise operator pythonmodule operatoror operator pythonor operator in pythonpython xor operatoroperator overloading in pythonpython and or operatordivide operator pythonpython operator itemgetterpython division operatorpython operator orderincrement operator in pythonconditional operator in pythonpython class operatorpython operatoryarithmetic operators in pythonbit operators pythonboolean operators in pythonimport operatorpython or and operatorcomparison operators in pythonpython logical operators example&& operator in pythonwhat is operator in pythonstring functions in pythonpython arithmetic functionsbuilt in functions pythonbuilt in functions in pythonlist functions in pythonmath functions in pythonpython logical operatorpython operator modulepython % string operatorpython what does += meanpython // double slash@ symbol in pythonpython increment operatorpython operator overloading