[Ubuntu-BD] bitwise right shift (>>)

Junayeed Ahnaf Nirjhor zombiegenerator at aol.com
Sun Mar 25 11:08:03 UTC 2012


Hmmm . that helped. thanks

-----Original Message-----
From: ubuntu-bd-bounces at lists.ubuntu.com
[mailto:ubuntu-bd-bounces at lists.ubuntu.com] On Behalf Of Kabbo Sarker
Sent: Sunday, March 25, 2012 4:01 PM
To: Ubuntu Bangladesh
Subject: Re: [Ubuntu-BD] bitwise right shift (>>)

I didn't know what it is. Just learnt it. It shifts the bits. For example
(in python shell):
3 >> 1 # 00 00 00 11 moves 1 bit right 00 00 00 00 01
#Output: 1

3 << 1 # 00 00 00 11 moves 1 bit left 00 00 00 01 10
#Output: 6

# you can experiment with numbers:
1 << 1
#Output: 2

1 << 2
#Output: 4

1 << 3
#Output: 8

1 << 4
#Output: 16

512 >> 8
#Output: 2


--
Ubuntu Bangladesh
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bd




More information about the ubuntu-bd mailing list