When in doubt, break it down!
>>> def divis(n, x, y): ... print(f"n%x = {n % x}") ... print(f"n%y = {n % y}") ... print(f"(n%x) | (n%y) = {(n%x) | (n%y)}") ... print(f"n % x | n % y = {n % x | n % y}") ... >>> divis(12, 3, 5) n%x = 0 n%y = 2 (n%x) | (n%y) = 2 n % x | n % y = 2If a value is divisible, it'd be 0. If either value is not divisible, then the bit-or will return that non-zero number (the remainder, which happens to be 2 in this case). Using the
or
keyword should work the same.