<float>range(0.0,100.0,0.1)

Greg Ewing greg at cosc.canterbury.ac.nz
Wed May 17 21:50:34 EDT 2000


David Goodger wrote:
> 
>     for i in range(1000):
>         print i/10.0

That's better from a numerical point of view, too,
since it avoids the accumulation of errors you'd get
if you repeatedly added 0.1.

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list