RosettaCodeData/Task/Bitwise-operations/Python/bitwise-operations-2.py
2023-07-01 13:44:08 -04:00

7 lines
243 B
Python

def bitwise(a, b):
print 'a and b:', a & b
print 'a or b:', a | b
print 'a xor b:', a ^ b
print 'not a:', ~a
print 'a << b:', a << b # left shift
print 'a >> b:', a >> b # arithmetic right shift