Comparing two columns in a matrix in python
<p>I have a file containing following data:  </p>

<pre><code>PAIR 1MFK 1 URANIUM 82 HELIUM 112 3.6997  
PAIR 2JGH 2 PLUTONIUM 98 POTASSIUM 88 5.3003  
PAIR 345G 3 SODIUM 23 CARBON 14 1.664  
PAIR 4IG5 4 LITHIUM 82 ARGON 99 2.5506
</code></pre>

<p>Now, I have to find whether column 5th's value is greater than the columns 7th's value or vice versa.
I used:</p>

<pre><code>inp = open("filename".'r').read().strip().split('\n')
for line in map(str.split, inp):
    k = line[5]
    m = line[7]
    if k &gt; m:
        print 'loop 1 satisfies'
    elif m &gt; k:
         print 'loop 2 satisfies'
    else:
         print 'loop error'
</code></pre>

<p>But the problem is I'm getting output like:</p>

<pre><code>loop 1 satisfies  
loop 1 satisfies  
loop 1 satisfies  
loop 1 satisfies  
</code></pre>

<p>But in case if 1st line 5th column's value 82 smaller than 7th's value.
I can't understand the reason for this kind of error.<br>
Please help. </p>
