x = 8 # 8 in Binary: 1000
y = x >> 2 # Right shift by 2 positions: 0010 (in binary) which is 2 in decimal
print(y) # Output: 2
x = 4 # 4 in Binary: 0100
y = x << 2 # Left shift by 2 positions: 10000 (in binary) which is 16 in decimal
print(y) # Output: 16
>>Desplazamiento a la derecha bit a bit
<< Desplazamiento a la izquierda bit a bit
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Bere
1 year, 1 month agosaturn_sam
1 year, 2 months agomplopez
1 year, 4 months agoDrMKG
1 year, 6 months agoDinsha
1 year, 8 months agozaxxy
2 years, 6 months agomacxsz
2 years, 7 months agochafikislam
2 years, 8 months agoAndresfv
2 years, 8 months ago