0
What does '|' mean?
What function does that symbol do
2 odpowiedzi
+ 5
| is "bitwise OR" operator.
It compares all bits of operands. If either of the bit being compared is one then corresponding bit in resulting number is 1 ,otherwise 0.
Example :
print(5|2)
6 => 110b
2 => 010b
110b => 6
#decimal equivalent of binary 110b is 6
print(3|9)
3 => 0011b
9 => 1001b
1011b => 11
#decimal equivalent of binary 1011b is 11
There are some other use cases than just binary operations but google is your friend.
0
Ok i understand thank you
So it compares the binary bits of the two decimal numbers using the OR operator