list of range of floats
Larry Bates
larry.bates at websafe.com
Wed Feb 14 12:43:58 EST 2007
Steve wrote:
> I'm trying to create a list range of floats and running into problems.
> I've been trying something like:
>
> a = 0.0
> b = 10.0
>
> flts = range(a, b)
>
> fltlst.append(flts)
>
> When I run it I get the following DeprecationWarning: integer argument
> expected, got float. How can I store a list of floats?
>
> TIA
> Steve
>
What does range of floats mean? How many floats are there
between 0.0 and 10.0? If you want the step to be 1.0
and beginning and ending values will be whole numbers then
this will work:
flts=[float(i) for i in range(1, 11)]
If you want arbitrary starting and ending floats and an
arbitrary step, you will need to write your own function.
-Larry
More information about the Python-list
mailing list