Run ❯
Get your
own Python
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
print(8 >> 4 - 2) """ Bitwise right shift has a lower precedence than subtraction, and we need to calculate the subtraction first. The calculation above reads 8 >> 2 = 2 More explanation: The >> operator moves each bit the specified number of times to the right. Empty holes at the left are filled with 0's. If you move each bit 2 times to the right, 8 becomes 2: 8 = 0000000000001000 becomes 2 = 0000000000000010 Decimal numbers and their binary values: 0 = 0000000000000000 1 = 0000000000000001 2 = 0000000000000010 3 = 0000000000000011 4 = 0000000000000100 5 = 0000000000000101 6 = 0000000000000110 7 = 0000000000000111 8 = 0000000000001000 9 = 0000000000001001 10 = 0000000000001010 11 = 0000000000001011 12 = 0000000000001100 """
2