how does "bitwise or (|)" operator work? | Sololearn: Learn to code for FREE!

+10

how does "bitwise or (|)" operator work?

I didn't understand that, how to use "|" operator in python.

1/18/2022 7:00:40 AM

Sujal

3 Answers

New Answer

+10

https://www.sololearn.com/learn/4073/?ref=app

+12

Bitwise or operator: Returns 1 if either of the bit is 1 else 0. Example: a = 10 = 1010 (Binary) b = 4 = 0100 (Binary) a | b = 1010 | 0100 = 1110 = 14 (Decimal)

+5

Then have a look to these links: https://stackoverflow.com/questions/1746613/bitwise-operation-and-usage