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

Bitwise OR Operator

Yi

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)
4 views1 page

Bitwise OR Operator

Yi

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

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

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

=> ------------------------------------------------------------
var1 var2 var1 | var2
------------------------------------------------------------
0 1 1
1 0 1
0 0 0
1 1 1
------------------------------------------------------------
------------------------------
Examples
------------------------------
>>> 0|0-----------0
>>> 0|1-----------1
>>> 1|0-----------1
>>> 1|1-----------1
-------------------------------
>>> a=10
>>> b=12
>>> c=a|b
>>> print(c)--------14
>>> print(5|4)----5
-----------------------------
Most Imp Points
-----------------------------
>>>s1={10,20,30}
>>>s2={10,15,25}
>>> s3=s1|s2 # Bitwise OR Operator for UNION Operation
>>> print(s3,type(s3))--------{20, 25, 10, 30, 15} <class 'set'>
--------------------------
>>> s1={"Python","Data Sci"}
>>> s2={"C","C++","DSA"}
>>> print(s1,type(s1))------------{'Python', 'Data Sci'} <class 'set'>
>>> print(s2,type(s2))-----------{'C', 'DSA', 'C++'} <class 'set'>
>>> s3=s1|s2
>>> print(s3,type(s3))---------{'C', 'DSA', 'C++', 'Python', 'Data Sci'} <class
'set'>
=====================================x==================================

=====================================x==================================

You might also like