Explanation:
1. ord("A")
ord() converts a character into its Unicode code point.
ord("A")
Output:
65
So, "A" → 65.
2. ord("a")
Similarly:
ord("a")
Output:
97
So, "a" → 97.
3. ^ — Bitwise XOR
Now Python evaluates:
65 ^ 97
Convert both numbers to binary:
65 = 01000001
97 = 01100001
XOR rules:
0 ^ 0 → 0
0 ^ 1 → 1
1 ^ 0 → 1
1 ^ 1 → 0
Therefore:
01000001
^ 01100001
-----------
00100000
00100000 in decimal is 32.
4. print()
Finally:
print(32)
✅ Final Output
32

0 Comments:
Post a Comment