-7
year=1992

print (year%4==0 and (year%100==0 or year%400==0))

print (year%4==0 & (year%100==0 or year%400==0))

Why two output are not equal?

Humayun Ahmad Rajib
  • 1,488
  • 1
  • 9
  • 20

1 Answers1

1

Operator precedence. Bitwise operations have higher precedence than equality comparison operator, so your bitwise operation is being computed as:

print (year%4 == (0 & (year%100==0 or year%400==0)))
Lie Ryan
  • 58,581
  • 13
  • 95
  • 141