vimal 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
>
Homework?
/W
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 3, 2007, at 2:18 AM, vimal wrote:
> 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
I don't think it can be done with *only* a range function...
import math
[pow(2, x) for
On 10/3/07, vimal <[EMAIL PROTECTED]> 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 lo
>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/ma
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
--
http://mail.python.org/mailman/listinfo/python-list