In Python, operators are symbols that help us carry out specific operations. Operations between variables, values, and variables as well as values and values can be used.
Operators that are used in Python:
- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Identity Operators
- Membership Operators
- Bitwise Operators
Arithmetic Operators:
Arithmetic Operators are used to carry out common mathematical operations including addition, multiplication, subtraction, and division. It includes almost all of the operations that a calculator can help us with. Such operators are represented by the symbols *, /,%, -, //, etc.
Assignment Operators:
A variable can be given values using the assignment operator. Sometimes it’s necessary to transfer a variable’s value to another variable; in these situations, the right operand’s value is transferred to the left operand. The requirement that an assignment operator have an equal-to(=) sign is one of the fundamental indicators by which we can identify it. Assignment operators like +=, -=, and /= are often employed.
Comparison operators:
Relational operators are another name for comparison operators. They evaluate the relationship between the values on either side of the operator by comparing them. The comparison operators ==, >,, >=, etc. are frequently employed.
Logical operator
The AND, OR, and NOT logical operations are carried out using logical operators. They are typically used to combine several criteria in conditional expressions. The logical operations are carried out using the AND, OR, and NOT keywords.
Identity operations:
An identity operator determines whether two operands have the same identity, which denotes whether they are located in different locations in memory, or not. The identity operands’ keywords are “is” and “is not.”
Membership operand:
The membership operand determines whether or not a value or variable is a part of a sequence. The sequence may take the form of a text, list, tuple, etc. For membership operands, the phrases “in” and “not in” are used as keywords.
Bitwise Operand:
Bit by bit operations on binary numbers are carried out using bitwise operands. The numbers must first be converted from decimal to binary format before being compared using AND, OR, XOR, NOT, etc.