0% found this document useful (0 votes)
6 views9 pages

Python Operators Explained

The document provides an overview of various operators in Python, including arithmetic, bitwise, membership, logical, relational, and assignment operators. Each operator is explained with its symbol and a brief description of its function. Understanding these operators is essential for writing effective Python code.

Uploaded by

bossarshkhan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views9 pages

Python Operators Explained

The document provides an overview of various operators in Python, including arithmetic, bitwise, membership, logical, relational, and assignment operators. Each operator is explained with its symbol and a brief description of its function. Understanding these operators is essential for writing effective Python code.

Uploaded by

bossarshkhan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

OPERATORS IN

PYTHON
NAME : ARSH KHAN
CLASS : XII B
ROLL NO : 12
INTRODUCTION TO PYTHON OPERATORS :

• Operators in python are symbols that perform various operations on [Link] provides a wide
range of operators for arthematic,logical,assignment,comparison and [Link] operators
are essential for writing effective and efficient Python codes.
ARTHEMATIC OPERATORS :

• - `+` (Addition): Adds two operands. `x + y` - `-` (Subtraction): Subtracts the second operand from the
first. `x - y` - `*` (Multiplication): Multiplies two operands. `x * y` - `/` (Division): Divides the first
operand by the second. `x / y` - `%` (Modulus): Returns the remainder of a division. `x % y` - `**`
(Exponentiation): Raises the first operand to the power of the second. `x ** y` - `//` (Floor Division):
Divides and returns the largest integer less than or equal to the result. `x // y`
BITWISE OPERATORS:

• - `&` (AND): Performs bitwise AND operation. `x & y` - `|` (OR): Performs bitwise OR operation. `x | y` -
`^` (XOR): Performs bitwise XOR operation. `x ^ y` - `~` (NOT): Performs bitwise NOT operation. `~x` -
`<<` (Left Shift): Shifts the bits of the first operand left by the number of positions specified by the
second operand. `x << y` - `>>` (Right Shift): Shifts the bits of the first operand right by the number of
positions specified by the second operand. `x >> y`
MEMBERSHIP OPERATORS :

• - `in`: Returns True if a sequence with the specified value is present in the object. `x in y` - `not in`:
Returns True if a sequence with the specified value is not present in the object. `x not in y`These
operators allow you to perform a wide range of operations in Python, from basic arithmetic to complex
logical and bitwise operations.
LOGICAL OPERATORS :

• - `and`: Returns True if both statements are true. `x and y` - `or`: Returns True if one of the statements
is true. `x or y` - `not`: Reverses the result, returns False if the result is true. `not x`
RELATIONAL OPERATORS :

• - `==` (Equal): Checks if the values of two operands are equal. `x == y` - `!=` (Not Equal): Checks if the
values of two operands are not equal. `x != y` - `>` (Greater than): Checks if the left operand is greater
than the right. `x > y` - `<` (Less than): Checks if the left operand is less than the right. `x < y` - `>=`
(Greater than or Equal to): Checks if the left operand is greater than or equal to the right. `x >= y` - `<=`
(Less than or Equal to): Checks if the left operand is less than or equal to the right. `x <= y`
ASSIGNMENT OPERATORS :

• - `=` (Assignment): Assigns a value to a variable. `x = y` - `+=` (Add and Assign): Adds and assigns the
result. `x += y` is equivalent to `x = x + y` - `-=` (Subtract and Assign): Subtracts and assigns the result. `x
-= y` is equivalent to `x = x - y` - `*=` (Multiply and Assign): Multiplies and assigns the result. `x *= y` is
equivalent to `x = x * y` - `/=` (Divide and Assign): Divides and assigns the result. `x /= y` is equivalent to
`x = x / y` - `%=` (Modulus and Assign): Modulus and assigns the result. `x %= y` is equivalent to `x = x %
y` - `**=` (Exponent and Assign): Exponentiation and assigns the result. `x **= y` is equivalent to `x = x
** y` - `//=` (Floor Division and Assign): Floor division and assigns the result. `x //= y` is equivalent to `x
= x // y`
THANK YOU <<<<

You might also like