-1

Can someone help me to understand in Python print(4 & 3)-->0 and print(5 & 4)--> 4?

paulS
  • 23
  • 1

1 Answers1

1

The & operation is a bitwise ANDing each pair of corresponding bits:

  • 4 & 3 == b100 & b011 == b000 = 0
  • 5 & 4 == b101 & b100 == b100 = 4
goodvibration
  • 5,980
  • 4
  • 28
  • 61