How Come 2 ^ 3 = 1 In Python 3.9
Shouldn't it be 8? The same thing goes with 3 ^ 2. I also got 1. This is confusing...
Solution 1:
In Python, ^
is a bitwise XOR operator. I believe what you're looking for is the exponent operator, **
. An example would be 2**3
which outputs 8
, like I believe you were looking for.
Post a Comment for "How Come 2 ^ 3 = 1 In Python 3.9"