-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
193k20 gold badges147 silver badges277 bronze badges
asked Jan 22, 2020 at 23:58
1
  • It will make more sense if you print those numbers in Hex. Commented Jan 23, 2020 at 0:13

1 Answer 1

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

answered Jan 23, 2020 at 0:01
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.