Operators
Operators
Operators
What is an Operator?
• An Operator is a character that represents a specific
mathematical or logical action or process.
• The values that an operator acts on are called operands.
• Some important operators programmers use :
• Arithmetic operator
• Assignment operator
• Logical operator
Operators
Types Of Operators:
o Arithmetic Operator
o Assignment Operator
o Comparison Operator
o Logical Operator
o Identity Operator
o Membership Operator
Operators
Arithmetic operator:
Arithmetic operators are used with numeric values to perform common
mathematical operations.
Operators
Arithmetic operator:
Operators
Example: Output:
Operators
Assignment operator:
o Assignment operator is used to assign the value, variable and function
to another variable.
Operators
Assignment operator:
Operators
Example: Output:
Operators
Comparison operator:
o Comparison operators are used to Compare two values.
o If the condition is true it returns true. Else, it returns false.
Operators
Comparison operator:
Operators
Example: Output:
Operators
Logical operator:
o Logical operators are used on conditional statements.
Operators
Logical OR operator:
o Logical or operator returns True if either of the operands are True, else
it returns False.
Example: Output:
Operators
Identity operator:
o Identity operators are used to compare two object whether the objects
are same and share same memory location.
Operators
Identity is operator:
o Identity is operator evaluates to True if the variables on either side of
the operator point is the same objects. else, false.
Example: Output:
Operators
Membership operator:
o Membership operators are used to test if a sequence is presented in an
object.
Operators
Membership in operator:
o The in operator is used to check is a character exists in a sequence or
not.
Example: Output:
Operators