<float>range(0.0,100.0,0.1)

David Goodger dgoodger at bigfoot.com
Wed May 17 18:15:20 EDT 2000


on 2000-05-17 15:57, Warren Postma (embed at geocities.com) wrote:
> how do you do this:
> 
> for i in range(0.0, 100.0, 0.1):
> print i

This will do it:

    for i in range(1000):
        print i/10.0

Remember, if you want the range to finish at exactly 100.0 (not 99.9),
you'll need range(1001). You may want to consider xrange(); see section 2.3
of the library reference.

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)




More information about the Python-list mailing list