0
hey, guuuys, pls explain me, what these (&, ā§, |)operators do?
2 Answers
+ 1
They are Binary operators (you can search about them using any search engine) ,they work on bits ,instead on number
Like for example 3|5
3 has a binary value equal to 0b11
and 5 has a binary value equal to 0b101
"|" is a binary "or" operator which compared two bits like
for 1 and 0 it will return 1 ,
for 1 and 1 it will return 1,
And for 0 and 0 it will return 0
So if we compare the above two binary values
0b011
0b101
we get 0b111 which is equivalent to 7 in decimal system ,"0b is a prefix which is used for representing binary number in python
0
shoul i know all of these binary values? it seems horribleš