[ad_1]
Types of Operators in Python-What are Operators? Operator is a job in an industry. The main task of the operator is to perform an operation. The operator contained in Python is a special symbol that is used to carry out a certain operation. Whether it’s an arithmetic operation or a logical operation, the value being operated by the operator is called an operand.
Here is a simple example of the arithmetic operators in Python:
In the program code above, the + sign is an operator while the numbers 10 and 7 are operands. From the above operation, we get the final result in the form of an integer value of 17.
Types of Operators in Python
There are 7 types of operators in Python, let’s discuss one by one:
- Arithmetic Operators
Arithmetic operators are operators used to calculate mathematical operations, ranging from addition, subtraction, multiplication, division, power, and much more.
2. Comparison / comparison operator
This operator is an operator that is used to compare between two operators. Is 1 greater than 2 operands, or are they the same.
3. Assignment operator
This operator is used to assign an assignment to a variable or in human language. The assignment operator also functions to assign a value to a variable.
4. Logical Operators
Logical operators are very important operators in Python. It is closely related to the comparison operator and both also return a value of the same data type i.e. boolean.
5. Membership Operators
Python is a programming language that is quite unique, it has special operators or is also often referred to as special operators. Named special because this operator only exists in Python and no other programming language.
Among the special operators there is a membership operator or in English is membership operator. This membership operator has two variants, namely in and not.
6. Identity operators
Python also has another special operator, namely the identity operator. The task of this operator is to find out whether two variables have the same value and the same position in memory. Because not all the same value has the same place in memory.
7. Bitwise Operators
Bitwise operators are operators related to binary numbers. The binary number is anumbers 0 and 1 In essence, this is a step that can be understood by the machine.
The above is an explanation of the operators in Python. Hopefully you can understand the discussion above so that you can learn more about Python.
[ad_2]