+ 2

what are the bitwise operations: & | ^ << >>. and how they differ from usual "or" "and" etc...

help please can not find an explanation anywhere

13th Aug 2020, 11:43 AM
иван
иван - avatar
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.
13th Aug 2020, 12:58 PM
Aymen
+ 2
yessine , what does it mean to "return one of the values ​​"? i am newbie and saw these operators in lesson "operator priority"
13th Aug 2020, 1:09 PM
иван
иван - avatar
+ 2
SoloLearn has a lesson about the bitwise operators. https://www.sololearn.com/learn/4070/?ref=app
15th Aug 2020, 10:28 AM
Seb TheS
Seb TheS - avatar
+ 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
13th Aug 2020, 12:04 PM
Steven M
Steven M - avatar