-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,502
  • 1
  • 10
  • 22

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
  • 62,238
  • 13
  • 100
  • 144