minus-squarehera@feddit.uktoPython@programming.dev•Why can't I use the '|' bitwise operator in this statement?linkfedilinkEnglisharrow-up8·2 months ago| is not equivalent to “or”. In bitwise operations the integer is converted into bits and the operation is done on a per-bit level. See: https://www.geeksforgeeks.org/python-bitwise-operators/ Eg. 1 | 2 is 3 where as 1 or 3 is 1 linkfedilink
| is not equivalent to “or”. In bitwise operations the integer is converted into bits and the operation is done on a per-bit level. See: https://www.geeksforgeeks.org/python-bitwise-operators/
Eg.
1 | 2
is 3 where as1 or 3
is 1