+ 2
What do the operators << and >> do?
For example: x = 3 print (x >> 2)
3 Antworten
+ 2
Those are shift operators, they shift the bits of the number to the other side and do some stuff, it's complicated to explain that bitwise stuff, so here is how to do it numerically:
x<<y = x*(2**y)
x>>y = x/(2**y)
-The << multiplies first number with 2 power second number
-The >> divides first number with 2 power second number
EDIT: they will always return an integer(a whole number) so if the result is 0.6 it goes down to 0 in the output
+ 6
Left and right shifting of bits.
+ 1
I get it. Thanks!!