Professional Documents
Culture Documents
Objectives
✔ Types of Operators?
What is Python Operators?
Arithmetic Operators
Comparison (Relational)
Logical Operators
Arithmetic Operators
Addition Operator
Example :
val1 = 2
val2 = 3
print(res)
Output:
5
Modulus Operator
Example :
val1 = 3
val2 = 2
Output :
1
Exponentiation Operator
val1 = 2
val2 = 3
Output :
8
Comparison Operator
Comparison Operator
Syntax:
x>y
Example:
a=9
b=5
# Output
print(a > b)
Output:
True
Comparison Operator
Equal to: This operator returns True if both the operands are
equal i.e. if both the left and the right operand are equal to each
other.
Example:
a=9
b=5
# Output
print(a == b)
Output:
False
Logical Operator
Logical Operator
Example: