- 6
Questions : print(5|3) (Me:š¤£It's Error) >>> 7(Me:š¤£šš š¤¤What!!!) How?
3 Answers
+ 7
DEC BIN
5 0101
3 0011
---------------- | OR
7 0111
OR operator yields true (1) when either of its operands were true.
+ 7
Hi format your question properly ,
| is binary OR operatoror that compres the value between two numbers bits, if it's 1 or 0 returns 1 ,if it's 1 or 1 return 1 and if it's 0 or 0 returns 0 ,
Binary value of 5 is
0b101
Binary value of 3 is
0b011
If you apply the above operator you get 0b111 which is equal to 7 in decimal