generating range of numbers

Amit Khemka khemkaamit at gmail.com
Wed Oct 3 05:30:13 EDT 2007


On 10/3/07, vimal <cool.vimalsmail at gmail.com> wrote:
> hi all,
>
>      i am new to python.....
>      i just want to generate numbers in the form like:
>
>     1,2,4,8,16,32.....to a maximum of 1024
>
>     using a range function

[2**i for i in range(11)]

This is a list comprehension, for more have a look at
http://docs.python.org/tut/node7.html#SECTION007140000000000000000

Cheers,

-- 
----
Amit Khemka
website: www.onyomo.com
wap-site: www.owap.in



More information about the Python-list mailing list