[Tutor] trouble with if

Bryan Fodness bryan.fodness at gmail.com
Thu Oct 25 04:15:17 CEST 2007


I have the following code, it keeps giving me a value of 1 for e.

for line in file('21Ex6MV_oaf.dat'):
    oa, openoa, w15, w30, w45, w60 = line.split()
    if (float(oa) == round(offaxis)) and (eff_depth < 10 and unblockedFS >
15):
        e = float(openoa)
    else:
        e = 1

If I comment out the else, I get the correct value

for line in file('21Ex6MV_oaf.dat'):
    oa, openoa, w15, w30, w45, w60 = line.split()
    if (float(oa) == round(offaxis)) and (eff_depth < 10 and unblockedFS >
15):
        e = float(openoa)
#    else:
#        e = 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071024/a69b30eb/attachment.htm 


More information about the Tutor mailing list