generating range of numbers

Andreas Tawn andreas.tawn at ubisoft.com
Wed Oct 3 11:28:44 CEST 2007


>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

>>> a = [2**x for x in range(11)]
>>> a
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]

Cheers,

Andreas Tawn
Lead Technical Artist
Ubisoft Reflections

-- 
http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list