+ 1
symbol
Anyone knows what this symbol“>>” means? print(2>>2) #Output:0 print(3>>2) #Output:0 print(4>>2) #Output:1 print(8>>2) #Output:2 print(10>>2) #Output:2 print(12>>2) #Output:3 I really curious about how this symbol made the output🥴
3 Respuestas
+ 2
This is what I found by searching"right shift operator":
Takes two numbers, right shifts the bits of the first operand, the second operand decides the number of places to shift. In other words right shifting an integer “x” with an integer “y” denoted as ‘(x>>y)‘ is equivalent to dividing x with 2^y.
eg: lets take N=32; which is 100000 in Binary Form.
Now, if “N is right-shifted by 2” i.e N=N>>2 then N will become N=N/(2^2). Thus, N=32/(2^2)=8 which can be written as 1000.
+ 3
Look for bitwise right shift in this
https://www.sololearn.com/learn/4070/?ref=app
+ 1
Thanks Ipang, it really helps me!