why python cannot judge 1.0 equals to 1 in some cases, but other cases can?
<p>There is a python code as following:</p>

<pre><code>import sys
import fileinput, string
K = 3
f = raw_input("please input the initial "+str(K)+" lamba: ").split()

Z = []
sumoflamba = 0.0
for m in f:
    j = m.find("/")
    if j!=-1:
            e=float(m[:j])/float(m[j+1:])
    else:
            e = float(m)
    sumoflamba+=e
    if e==0:
            print "the initial lamba cannot be zero!"
            sys.exit()
    Z.append(e)
print sumoflamba
if sumoflamba!=1:
    print "initial lamba must be summed to 1!"
    sys.exit()
</code></pre>

<p>When I run it with 0.7, 0.2, 0.1. It will print the warning and exits! However, when I run it with 0.1, 0.2, 0.7. It works fine. 0.3, 0.3, 0.4 works fine too. I do not have a clue....Can someone explain this, please? 
The "print sumoflamda" will give 1.0 for all these cases.</p>
