bitwise shift?

Terry Reedy tjreedy at udel.edu
Wed Apr 25 17:21:56 EDT 2007


"desktop" <fff at sss.com> wrote in message 
news:f0of5a$nn9$1 at news.net.uni-c.dk...
|I have found a code example with this loop.
|
| for k in range(10, 25):
|       n = 1 << k;
|
|
| I have never read Python before but is it correct ...

One of the super-nice feature of Python is the interactive mode, also 
available with IDLE and other IDEs. that lets you explore the meaning of 
Python code faster than you can ask here.  Use it and learn.

>>> for k in range(10, 25): print 1 << k

1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216 






More information about the Python-list mailing list