Explanation:
1. 7 ^ 3 — Bitwise XOR
The ^ operator performs Bitwise XOR.
Convert the numbers into binary:
7 = 111
3 = 011
Apply XOR:
111
^ 011
-----
100
100 in binary is 4.
So:
7 ^ 3
becomes:
4
2. 4 & 5 — Bitwise AND
Now Python evaluates:
4 & 5
Binary representation:
4 = 100
5 = 101
AND keeps 1 only when both bits are 1:
100
& 101
-----
100
100 in binary is 4.
3. print()
The final statement becomes:
print(4)
✅ Output
4

0 Comments:
Post a Comment