Python Operator
Operators are the constructs which can manipulate the value of operands.
Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator.
Types of Operator
Python language supports the following types of operators.
- Python Arithmetic Operators
Assume variable a holds 10 and variable b holds 20, then
- Python Comparison Operators
These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators.
Assume variable a holds 10 and variable b holds 20, then
- Python Assignment Operators
Assume variable a holds 10 and variable b holds 20, then
- Python Bitwise Operators
Bitwise operator works on bits and performs bit by bit operation. Assume if a = 60; and b = 13; Now in binary format they will be as follows −
a = 0011 1100
b = 0000 1101
—————–
a&b = 0000 1100
a|b = 0011 1101
a^b = 0011 0001
~a = 1100 0011
There are following Bitwise operators supported by Python language
- Python Logical Operators
There are following logical operators supported by Python language.
Assume variable a holds 10 and variable b holds 20, then
- Python Membership Operators
Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below
- Python Identity Operators
Identity operators compare the memory locations of two objects. There are two Identity operators explained below:
If you are going for finest contents like I do, just pay a
quick visit this web page everyday because it provides feature contents, thanks