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.
_vt
3 weeks, 1 day agoBere
1 year, 4 months agosaturn_sam
1 year, 6 months agomplopez
1 year, 7 months agoDrMKG
1 year, 9 months agoDinsha
2 years agozaxxy
2 years, 9 months agomacxsz
2 years, 10 months agochafikislam
2 years, 12 months agoAndresfv
3 years ago