+ 1
Can somebody please explain this python challenge question to me?
a= 5|5 b= 10|5 print (a+b) the answer to this was 20, but I don't understand why. I've never seen this kind of assignment before, and I can't find any reference to it online
2 Respostas
+ 5
That's bitwise or.
In this context , it converts the numbers to binary takes 1 where ever possible and prints the decimal form of resulting binary number.
See the answer in this link for better understanding : https://stackoverflow.com/questions/5988665/pipe-character-in-JUMP_LINK__&&__python__&&__JUMP_LINK
+ 1
thank you! I'm familiar with bitwise operations, but did not know the syntax