Hacker News new | ask | show | jobs
by jvdvegt 339 days ago
Why would "0^5" evaluate to 5? (question 21)

And is there a way to link to a specific question?

2 comments

^ is the XOR operator, 0 XOR 5 is 5. (Exponentiation is *)

https://docs.python.org/3/library/operator.html#mapping-oper...

Exponentiation is ** or pow()
xor