In python, write code for program. There are three text files used in this program and i have put screenshot of data contained in the files.The file Pre1990.txt contains data from Apricot to Yellow Orange. The file Retired.txt contains data from Blue Gray to Violet Blue. The file Added.txt contains data from Antique Brass to Wisteria. Please also put screenshot of your code.
Expert Answer
Pre1990List = [line.rstrip() for line in infile]
infile.close()
Pre1990Set = set(Pre1990List)
infile = open(“Retired.txt”,’r’)
RetiredList = [line.rstrip() for line in infile]
infile.close()
RetiredSet = set(RetiredList)
Pre1990Set = Pre1990Set.difference(RetiredList)
infile = open(“Added.txt”,’r’)
AddedList = [line.rstrip() for line in infile]
infile.close()
AddedSet = set(AddedList)
Post1990Set = Pre1990Set.union(AddedSet)
Post1990Set = sorted(Post1990Set)
Post1990List = list(Post1990Set)
Post1990String = (‘n’).join(Post1990List)
outfile = open(“Post1990.txt”,’w’)
outfile.write(Post1990String)
outfile.close()