0

What does the "|" symbol mean?

def f(m,n): return m|n print(f(10,20)) Output: 30 Thank you for your help :)

4th Apr 2018, 7:30 PM
Stephane Gronemeyer
3 Respuestas
4th Apr 2018, 7:37 PM
Louis
Louis - avatar
+ 2
| means binary operation OR. 10 in binary is 1010 20 in binary is 10100 1010 | 10100 = 11110 (30) Make OR on each bit row: 01010 10100 11110
4th Apr 2018, 7:38 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 1
I understand perfectly now! Thank you!
4th Apr 2018, 7:58 PM
Stephane Gronemeyer