Operators refer to special symbols that perform operations on values and variables. Furthermore, the operands in python, one of the programming languages, refer to the values on which the operator operates. Most noteworthy, operators can carry out arithmetic, relational, and logical operations.
Arithmetic Operators in Python
The use of arithmetic operators and operands in python takes place to perform mathematical operations like addition, subtraction, multiplication and division.
There are 7 arithmetic operators in Python:
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
- Exponentiation
- Floor division
Addition Operator: In Python, the additional operator is +. Furthermore, its use takes place to add 2 values.
Example:
val1 = 2
val2 = 3
# using the addition operator
res = val1/val2
print(res)
Output
5
Subtraction Operator: In Python, the subtraction operator is –. Furthermore, its use takes place to subtract the second value from the first value.
Example :
val1 = 2
 val2 = 3
# using the subtraction operator
res = val1 - val2
# using the subtraction operator
res = val1 - val2
print(res)
Output :
-1
Multiplication Operator: In Python, the multiplication operator is *. Furthermore, its use takes place to find the product of 2 values.
Example:
Val1 = 2
Val2 = 3
# using the multiplication operator
res = val1 * val2
print(res)
Output :
6
Browse more Topics Under Variables, Expressions and Statements
- Values, Variables and Keywords
- Operator Precedence
- Expressions and Statement
- Taking Input and Displaying Output
- Putting Comments
Division Operator: In Python, / represents the division operator. Furthermore, its use takes place to find the quotient when the division of the first operand takes place by the second.
Example:
val1 = 3
val2 = 2
# using the division operator
res = val1 / val2
print(res)
Output :
1.5
Modulus Operator: In Python, % is the modulus operator. Furthermore, its use takes place to find the remainder when the division of the first operand happens by the second.
Example :
val1 = 3
val2 = 2
# using the modulus operator
res = val1 % val2
print(res)
Output :
1
 Exponentiation Operator: In Python, ** is the exponentiation operator. Furthermore, i to raise the first operand to power of second.
Example :
val1 = 2
val2 = 3
# using the exponentiation operator
res = val1 ** val2
print(res)
Output :
8
Floor division: In Python, conducting of floor division takes place by //. Furthermore, its use takes place to find the floor of the quotient when the division of the first operand takes place by the second.
Example :
val1 = 3
val2 = 2
# using the floor division
res = val1 // val2
print(res)
Output :
1
Relational Operators in Python
The use of relational operators and operands in python takes place for comparing the values. Furthermore, it either returns True or False in accordance with the condition. One may also call these relational operators in python as comparison operators.
Operator – >
Description – Greater than: True if the left operand is greater than the right
Syntax – x > y
Operator – <
Description – Less than: True if the left operand is less than the right
Syntax – x < y
Operator – ==
Description – Equal to: True if both operands are equal
Syntax – x == y
Operator – !=
Description – Not equal to – True if operands are not equal
Syntax – x != y
Operator – >=
Description – Greater than or equal to: True if the left operand is greater than or equal to the right
Syntax – x >= y
Operator – <=
Description – Less than or equal to: True if the left operand is less than or equal to the right
Syntax – x <= y
Logical Operators in Pythons
In Python, the use of logical operators and operands in python takes place on conditional statements (either True or False). Furthermore, with logical operands in python, the performance of Logical AND, Logical OR and Logical NOT operations takes place. Let us understand logical operators in python with clarity.
Operator – and
Description – Logical AND: True if both the operands are true
Syntax – x and y
Operator – or
Description – Logical OR: True if either of the operands is true
Syntax – x or y
Operator – not
Description – Logical NOT: True if the operand is false
Syntax – not x
FAQs For Operators and Operands in Python
Question 1: Differentiate between operators and operands in python?
Answer 1: Operators are special symbols that facilitate the manipulation of the variables and constants in the expressions. In contrast, operands in python are the variables or constants on which the operators work.
Question 2: Explain operands in python with example?
Answer 2: Example of operands in python can be “1 + 2” the “1” and “2”. Here, the operator is the plus symbol.
Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I also love your website because all type of information is available in your blogs. You made my day. Thanks you for everything. I have bookmarked more article from this website. Such a nice blog you are providing.