Bitwise Operators in Python.
#Bitwise
Operators with variables
a = 7
b = 4
print("The
Initialized value of A is = ",
a);
print("The
Initialized value of B is = ",
b);
print()
print("Bitwise
AND Operator : A & B = ", a&b)
print("Bitwise
XOR Operator : A ^ B
= ", a^b)
print("Bitwise
OR Operator : A | B
= ", a|b)
print()
a = 14
b = 6
print("The
Initialized value of A is = ",
a);
print("The
Initialized value of B is = ",
b);
print()
print("Bitwise
AND Operator : A & B = ", a&b)
print("Bitwise
XOR Operator : A ^ B = ", a^b)
print("Bitwise
OR Operator : A | B
= ", a|b)
Output
>>>
The
Initialized value of A is =7
The
Initialized value of B is =4
Bitwise
AND Operator : A & B =4
Bitwise
XOR Operator : A ^ B =3
Bitwise
OR Operator : A | B =7
The
Initialized value of A is =14
The
Initialized value of B is =6
Bitwise
AND Operator : A & B =6
Bitwise
XOR Operator : A ^ B =8
Bitwise
OR Operator : A | B =14
>>>
No comments
Post your comments