I'm getting different results when I add up a list of floats depending on the order that I list the floats. For example, the following returns False: def check(): totalProp=0 inputs=[0.2,0.2,0.2,0.1,0.2,0,0.1] for each in inputs: totalProp+=each print "totalProp=",totalProp if totalProp != 1: print "Your proportions must add up to 1" return False return True
However, if I swap, the 4th and 5th list items like this: totalProp=0 inputs=[0.2,0.2,0.2,0.2,0.1,0,0.1] for each in inputs: totalProp+=each print "totalProp=",totalProp if totalProp != 1: print "Your proportions must add up to 1" return False return True I get True returned. Can anyone tell me whats going on and how I can avoid the problem. Thanks Joanne Matthews -- http://mail.python.org/mailman/listinfo/python-list