"Mr Gerard Kelly" <s4027...@student.uq.edu.au> wrote

This is extremely weird, I think.

No, its normal and you got the right reason.... its due to floating point
binary representation issues.

Here is a tiny program:

from math import *
from Numeric import *

This is probably a bad idea here (in fact its usually a bad idea!) since
both math and numeric are likely to have similar names in them
By importing all names from the modules there is a high chance
of name clashes causing strange behaviour.

Better to use

import math, Numeric

Or, if that's too much typing, use

import math as M
import Numeric as N

x=[0]*10


for counter in rangelen((x)):
     x[counter]=counter*0.1

print x

Although of course you are not using anything from either math or
Numeric in this example, but I assume you intend to!?

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to