Why is it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is it?

x=5 print(x>>2) output: 1

11th Jan 2017, 7:44 AM
School Dog
5 Answers
+ 3
Hi my Friend , Do you have telegram ???
11th Jan 2017, 8:29 AM
Mohammad Zarchi
Mohammad Zarchi - avatar
+ 2
yes my telegram is Duvabi
12th Jan 2017, 5:29 AM
School Dog
+ 1
yes my telegram is Duvabi
12th Jan 2017, 5:28 AM
School Dog
0
Returns x with the bits shifted to the right by y places
11th Jan 2017, 7:57 AM
ASNM
ASNM - avatar
0
x = 5 5 in binary "101" x >> 2 meaning right shifting by 2 places result "1" in binary which "1" in decimal too let's look at another example: x = 1 in binary "1" x << 5 meaning shifting bits left by 5 places results in "10000" which is "16" in decimal another example: x = 5 which is "101" evaluating x << 2 we'll get "10100" which is "20" in decimal
26th Jan 2017, 9:31 AM
Arun Manoharan
Arun Manoharan - avatar