Skip to content

Commit 000b707

Browse files
committed
Added bitwise_operators.py to Python-Basic-to-Advance repo
1 parent dfe89cb commit 000b707

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bitwise_operators.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
a = 2 # binary: 10
2+
b = 4 # binary: 100
3+
4+
print(a >> 1) # right shift
5+
print(a << 1) # left shift
6+
print(a & b) # AND
7+
print(a | b) # OR
8+
print(a ^ b) # XOR

0 commit comments

Comments
 (0)