+ 3

How this operator " | " works in python

5th Jun 2019, 3:14 PM
SOUMYA
SOUMYA - avatar
3 ответов
+ 3
Soumya Sahu I'm not going to explain all of them, but it works like this: 5|30 5 is 00101 in binary 30 is 11110 If you compare them bitwise, you get a new number with a 1 where at least one of the bits is 1 and a 0 otherwise: 00101 (5) 11110 (30) ---------- 11111 (31) => 5|30 = 31
5th Jun 2019, 5:03 PM
Anna
Anna - avatar
+ 2
Then Please tell me how the output is coming of all these 👇👇👇 https://code.sololearn.com/cIViHAjR0LDj/?ref=app
5th Jun 2019, 3:37 PM
SOUMYA
SOUMYA - avatar
+ 2
Thank you so much Anna for explaining me.....
5th Jun 2019, 6:19 PM
SOUMYA
SOUMYA - avatar