I write a helpers.py as following. ok to compare to files with lines. but i don't know how to link it with compare.py. I know the staff said no need to open the file, the compare did it. But how do i load the string (a, b) from compare.py? Thanks.
from sys import argv
import sys
file1 = sys.argv[1]
file2 = sys.argv[2]
def lines(a, b):
"""Return lines in both a and b"""
return result
alines = set()
with open(file1, "r") as file1:
for line in file1:
alines.add(line.rstrip("\n"))
blines = set()
with open(file2, "r") as file2:
for lines2 in file2:
blines.add(lines2.rstrip("\n"))
result = alines & blines
print(lines(alines, blines))