0
print(9^10) in python
The output is 3..What is the logic or explanation behind this
2 Answers
+ 8
It is Bitwise XOR operator. It based on binary
9 = 00001001
10= 00001010
-----------------
3 = 00000011
^ which give 1 if both digits are different. Otherwise give 0.
https://www.sololearn.com/learn/4074/?ref=app
https://www.sololearn.com/learn/4070/?ref=app
+ 3
because '^' is the XOR bitwise operator... I guess you want the exponentiation operator wich is '**', so instead try:
print(9**10)