I've just started learning Python. After getting myself comfortable with Bash, I've decided to use Python and learn it. Please don't throw flame if this question seems stupid.
I got this "file.txt" which contains:
81
99
90
90
70
100
The if/else statement I'm using inside for loop does not seem to work:
with open('file.txt') as x:
for num in x:
if num > 90 :
print "NOT ok - ",num
else :
print "Okay - ",num
I can't understand why the output would be "NOT ok" for all the numbers.
NOT ok - 81
NOT ok - 99
NOT ok - 90
NOT ok - 90
NOT ok - 70
NOT ok - 100
Any help would be appreciated. Thanks.