What does ^ operator do in Python?
Question:
I’ve tried the following:
print(1^3) #output 2
print(1^5) #output 4
print(1^6) #output 7
These outputs don’t make any sense for me.
Answers:
It’s the bitwise XOR operator.
I’ve tried the following:
print(1^3) #output 2
print(1^5) #output 4
print(1^6) #output 7
These outputs don’t make any sense for me.
It’s the bitwise XOR operator.