-1

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
  • 151,199
  • 17
  • 111
  • 216
Al Lear
  • 1
  • 1

1 Answers1

0

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

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216