+ 1
I do not understand Bitwise Operators in Python
Please help me understand this
4 Réponses
+ 3
It's a large concept so can't tell you whole but trying little effort to to make you understand.
Bitwise operators are those operators which work on bit level.
All the integer value Will be converted into binary value and then bitwise operators will work on these bits.it can apply on only 2 datatypes int and bool.
Suppose :-
a=2
b=3
c=a&b #bitwise and operator
print (c)
Gives you output 2
What happened inside is:-
Binary of 2: 0010
Binary of 3: 0011
Bitwise & : 0010 # i.e 2
It will check & operator in every bit position.
I.e
0&0=0
0&1=0
1&0=0
1&1=1
+ 3
Try to review the chapter again. If that didn't help try to read people's comments in the comments section (of the chapter).
If after all that you still don't get it, feel free to ask in Q&A, BUT remember this, ask with good details, explaining what you had tried to overcome the issue. This shows a good will, an effort had been given, before you come to ask.
P.S. Don't take my word as discouragement, rather a suggestion 👍
+ 2
All of you guys thanks for suggesting and trying to answer my doubt