0% found this document useful (0 votes)
28 views3 pages

PYthon Class 9 Telugu

The document discusses various Python operators including unary, bitwise, comparison, logical, membership, identity and conditional operators. Examples are provided to demonstrate the usage and output of each operator.

Uploaded by

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

PYthon Class 9 Telugu

The document discusses various Python operators including unary, bitwise, comparison, logical, membership, identity and conditional operators. Examples are provided to demonstrate the usage and output of each operator.

Uploaded by

THE KING
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

~(complement) Operator

=======================

>>> print(~5)
-6
>>>
>>> print(~-9)
8
>>>
>>>
>>> print(~10)
-11
>>> print(~-13)
12
>>>
>>>
>>> print(10>>2)
2
>>>
>>> print(10<<2)
40
>>>
>>>
>>> print(True & True)
True
>>> print(True & False)
False
>>> print(False & True)
False
>>> print(False & False)
False
>>>
>>>
>>> print(True | True)
True
>>> print(True | False)
True
>>> print(False | True)
True
>>> print(False | False)
False
>>>
>>>
>>> print(True ^ True)
False
>>> print(False ^ False)
False
>>> print(True ^ False)
True
>>> print(False ^ True)
True
>>>
>>>
>>> print(~True)
-2
>>>
>>> print(True<<2)
4
>>>
>>> print(True>>2)
0
>>>
>>>

if x=10 then

1. x+5 ==> 15
2. x+=5 ==> x=x+5 ==> x=15

eg:

>>> x=10
>>> x+=5
>>> print(x)
15
>>>

Conditional Operators or Ternary Operators


===============================================

>>> a,b=100,200
>>> x=300 if a<b else 400
>>> print(x)
300
>>>
>>> x=300 if a>b else 400
>>>

Member ship Operators


==========================

>>> x="Welcome to Python Programming By Real Time Experts"


>>> print("Python" in x)
True
>>>
>>> print("Hello" in x)
False
>>>
>>> print("Python" not in x)
False
>>>
>>> print("Hello" not in x)
True

Identity Operators
=========================

>>> x=100
>>> y=100
>>>
>>> id(x)
2137890575824
>>> id(y)
2137890575824
>>>
>>>
>>>
>>> print(x is y)
True
>>>
>>> print(x is not y)
False
>>>
>>>
>>> x=10
>>> y=20
>>> id(x)
2137890384464
>>> id(y)
2137890384784

You might also like