Дан файл, компоненты которого являются целыми числами. Записать во второй файл все четные числа, делящиеся на 5 -Python(Питон)

with open("2", "w") as target:
    with open("1") as source:
        for num in source:
            if num.strip().endswith('0'):
                target.write(num)
with open("2", "w") as target:
    with open("1") as source:
        target.write(''.join(num for num in source.readlines() if not int(num.strip())%10))

Leave a Comment