Demo entry 5340747

print even numbers from teste2.txt file

   

Submitted by anonymous on Jun 16, 2016 at 22:35
Language: Python. Code size: 162 Bytes.

f = open('teste2.txt', 'r')
a = 1
for line in f:
    if a == 0:
        a = a + 1
        print line.strip()
    elif a == 1:
        a = a - 1
f.close() 

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).