Comparing two file's characters
Using the previous code that I made, this compares the characters used in both files and returns which characters one has that the other does not.
def compare():
file1 = characters()
file2 = characters()
in_file1_not_file2 = []
in_file2_not_file1 = []
for x in file1:
if x not in file2:
in_file1_not_file2.append(x)
for x in file2:
if x not in file1:
in_file2_not_file1.append(x)
print("Characters in first file but not in second file:", in_file1_not_file2)
print("Characters in second file but not in first file:", in_file2_not_file1)
Comments
Post a Comment