I found out something interesting in Python. When I input: 99 & 100 Out is 96. What does '&' do with these numbers? Why is the answer '96'? It looks so wierd...
Thank you in advance!
OneCricketeer
193k20 gold badges147 silver badges277 bronze badges
-
It will make more sense if you print those numbers in Hex.Mark Ransom– Mark Ransom2020年01月23日 00:13:25 +00:00Commented Jan 23, 2020 at 0:13
1 Answer 1
It's a bitwise operator. The manipulated unit is the binary representation of the numbers
examples
3 10
5 11 &
------
3 10 =
and
2 01
3 10 &
------
0 00 =
Do the same for 99 & 100, you'll get out 96 in binary
answered Jan 23, 2020 at 0:01
OneCricketeer
193k20 gold badges147 silver badges277 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-py