X | Y | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

X | Y

print(x | y) what is the | doing ?

18th Aug 2018, 11:24 AM
Mbrustler
Mbrustler - avatar
6 Answers
+ 4
example: 3 = 0011 5 = 0101 3l5 = 0111 = 7 if there is a one on the position in 3 or 5, the result will be 1. first position: 0 or 0 = 0 second position: 0 or 1 = 1 third: 1 or 0 = 1 fourth: 1 or 1 = 1 result : 111
18th Aug 2018, 11:40 AM
davy hermans
davy hermans - avatar
18th Aug 2018, 11:32 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
011 = 3 100 = 4 101 = 5 110 = 6 111 = 7
18th Aug 2018, 12:33 PM
davy hermans
davy hermans - avatar
+ 1
thanks :)
18th Aug 2018, 11:34 AM
Mbrustler
Mbrustler - avatar
+ 1
You are welcome :) !
18th Aug 2018, 11:36 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
isnt 1011 = 11? and what is the bitwise or needed for ?
18th Aug 2018, 11:47 AM
Mbrustler
Mbrustler - avatar