0% found this document useful (0 votes)
6 views1 page

Bitwise AND Operator

Ty

Uploaded by

akkireddy55555
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)
6 views1 page

Bitwise AND Operator

Ty

Uploaded by

akkireddy55555
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/ 1

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

4. Bitwise AND Operator (& )


======================================
=>The Functionality of Bitwise AND Operator ( | ) is shown in the following Truth
table.

=> ------------------------------------------------------------
var1 var2 var1 & var2
------------------------------------------------------------
0 1 0
1 0 0
0 0 0
1 1 1
------------------------------------------------------------

Examples
----------------------------------
>>> 0&1---------------0
>>> 1&0---------------0
>>> 0&0---------------0
>>> 1&1---------------1
-----------------------------------
>>> a=8
>>> b=6
>>> c=a&b
>>> print(c)-------0
------------------
>>> a=10
>>> b=12
>>> c=a&b
>>> print(c)--------8
-----------------------------
Most Imp Points
-----------------------------
>>>s1={10,20,30}
>>>s2={10,15,25}
>>> s3=s1&s2 # Bitwise AND Operator for INTERSECTION Operation
>>> print(s3,type(s3))-------{10} <class 'set'>
--------------------------------------------
>>> s1={"Python","Data Sci"}
>>> s2={"C","C++","DSA","Python"}
>>> s3=s1&s2
>>> print(s3,type(s3))----------{'Python'} <class 'set'>
-----------------------
>>> s1={"Python","Data Sci"}
>>> s2={"C","C++","DSA"}
>>> s3=s1&s2
>>> print(s3,type(s3))-----------set() <class 'set'>
======================================x===============================

You might also like