+ 1
Anyone know what this "|" Bitwise mean in pynthon??
5 odpowiedzi
+ 5
Bitwise operators are used to compare (binary) numbers:
Operator Name Description
& AND Sets each bit to 1 if both bits are 1
| OR Sets each bit to 1 if one of two bits is 1
^ XOR Sets each bit to 1 if only one of two bits is 1
~ NOT Inverts all the bits
<< Zero fill left shift Shift left by pushing zeros in from the right and let the leftmost bits fall off
>> Signed right shift Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off
+ 5
This is bitwise OR. You can see here how to understand it:
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/trypython.asp?filename=demo_oper_or
+ 2
You can find it out by searching for "bitwise operations in Python"
https://realpython.com/python-bitwise-operators/
+ 2
Thanks then what context would it have or output if comes likes this print(5|3)
0
Thank you guys😊🙏