Answered! In python, write code for program. There are three text files used in this program and i have put screenshot of data…

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.

33. Crayon Colors At the beginning of 1990, a complete box of Crayola crayons ha 72 colors (in the file Pre1990.txt). During the 1990s, 8 colors were retired (in the file Retired. txt) and 56 new colors were added (in the file Added. txt). Write a program that creates a text file containing the post-1990s set of 120 colors in alphabetical order. Note: The first four lines of the new text file will contain the colors Almond, Antique Brass, Apricot, and Aquamarine

Expert Answer

 infile = open(“Pre1990.txt”,’r’)

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()

Still stressed from student homework?
Get quality assistance from academic writers!