You are on page 1of 24

PRESENTED BY NAWAZ AHMAD

CONTENT

 OPERATOR

 TYPES OF OPERATOR ON THE BASIS OF OPERAND


 Unary Operator
 Binary Operator
 Ternary Operator

 TYPES OF OPERATOR ON THE BASISS OF OPERATION

Arithmetic Operator
Assignment Operator
Relational Operator
Logical Operator
Identity Operator
Bitwise Operator
OPERATOR

 Operator is a Symbol that is used to perform


mathematical or logical operations on variables
and values.
Example:-

{ In this example , we use the( + )operator


a=10
to add together two values }
b=5
print(a+b)

OUTPUT=15
UNARY OPERATOR

 A Unary Operator is a computational operator


that takes any action on one operand and produces
only one result.
Examples:-
++a
-20
!a
BINARY
OPERATOR
 The operators that performs function on a two
operand are called Binary Operators.
a+b
a>5
b=4

Example:-
a=5
b=3
print(a + b)

OUTPUT: 8
Ternary OPERATOR

A ternary operator, which allows you to write a


concise conditional expression in a single line.

The ternary operator is also known as the conditional


operator.

SYNTAX:-

value_if_true if condition else value_if_false


Here's how it works:

Syntax :- value_if_true if condition else value_if_false

• Condition is the expression that is evaluated as either True or


False.

• If condition is True, the expression value_if_true is returned.

• If condition is False, the expression value_if_false is returned.


Increment OPERATOR

The increment operator is used to increment the value of a


variable in an expression.

 Pre-Increment:-In the Pre-Increment, value is first


incremented and then used inside the expression.
Example:-
a=10
a+=1
print(a)

OUTPUT: 11

In Python, there is no post-increment operator like you might find in


some other programming languages such as C++,Java.
decrement OPERATOR

The decrement operator is used to decrement the value of a


variable in an expression.

Pre-Decrement:- In the Pre-Decrement value is first


decremented and then used inside the expression
Example:-
a=8
a -=1
print(a)

OUTPUT: 7

Python does not have a post-decrement operator like


some other programming languages (e.g., C++, Java)
ASSIGNMENT OPERATOR

Assignment Operator are used to assign the values.


ARITHMETIC OPERATOR

 Arithmetic Operators are used to perform


mathematical operations like addition, subtraction,
multiplication, and division.
RELATIONAL OPERATOR

Relational operators are used for comparing the values.


It either returns True or False according to the
condition.
These operators are also known as Comparison
Operators.
LOGICAL OPERATOR

logical operators are used to perform logical


operations on boolean values (True or False).

Python provides three main logical operators


are:

 and
or
not
IDENTITY OPERATOR

Identity operators are used to compare the memory


locations of two objects to determine if they are the same
object or not.

Python provides two main identity operators:

 is
 is not
BITWISE OPERATOR

Bitwise operators are used to manipulate individual


bits of integers.

Python supports several bitwise operators for


performing bitwise operations on integers.

These operators work at the binary level and allow


you to perform operations like bitwise AND, OR,
XOR, left shift, and right shift.

You might also like