Python operator – Operators can be used to evaluate operations on variables and values.
For example –
In this example, we have used “+” operator to add two variables together.
The operators have been divided into the following categories:
Comparison drivers – These are used to compare two values.
Example – ==, !=, >, <, >=, <=
Arithmetic operators – These are used with numeric values to perform general mathematical operations:
Example – +, -, *, /, %, etc
Assignment operators – These are used to assign values to variables:
Example – =, +=, -=, *=, /=, etc
Identity operators – These are used for comparing the objects, not if they are equal, but also if they are actually the same object, with the same memory location/address
Example – is, is not
Membership Operators – These are used to test if a sequence is presented in an object.
Example – in, not in
Logical Operators – These are used to combine conditional statements
Example – and, or, not
Bitwise Operators – These are used to compare (binary) numbers
Example – &, |, ^, ~, etc