+ 2
what are the bitwise operations: & | ^ << >>. and how they differ from usual "or" "and" etc...
help please can not find an explanation anywhere
5 Antworten
+ 2
'and', 'or' er cetera, do not really calculate anything..
Instead, they just return one of the values (depending on the operands and the operator)
Bitwise & | ^ CALCULATE an often new value, using both operands, doing the operation bit by bit.
As to << >>, the difference is clear.
+ 2
yessine , what does it mean to "return one of the values "? i am newbie and saw these operators in lesson "operator priority"
+ 2
SoloLearn has a lesson about the bitwise operators.
https://www.sololearn.com/learn/4070/?ref=app
+ 1
The bitwise operators compare Least Significant Bits. This is a binary operation, and the ones place gets compared
print(1 & 1)
print(1 & 2)
https://en.m.wikipedia.org/wiki/Bit_numbering
https://wiki.python.org/moin/BitwiseOperators