Explain me this code pls | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
26th Sep 2020, 10:52 AM
Smiley[Offline]
2 Answers
26th Sep 2020, 10:53 AM
Simba
Simba - avatar
+ 3
Binary or "|" ,compares the bits of two numbers and returns 1 if 1and 0, 1 if 1 and 1, 0 if 0 and 0 Binary value of 5 is =>0b101 0b101 0b101 with or operator results in 0b101 Binary value of 10 is 0b1010 0b1010 0b0101 with or operator results in 0b1111 0b101 is equivalent to 5 in decimal number system and 0b1111 is equivalent to 15 So 5+15=20
26th Sep 2020, 10:59 AM
Abhay
Abhay - avatar