Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CODE MUST BE IN PYTHON. Assignment id: ola8 Assignment type: Project Required Files: ola8.py, myout.log Lab description: Stuff Inc. and Things Ltd. are merging to
CODE MUST BE IN PYTHON. Assignment id: ola8 Assignment type: Project Required Files: ola8.py, myout.log Lab description: Stuff Inc. and Things Ltd. are merging to form a new company called OfficesRUs. You have been asked to take the inventory lists for these companies, stored in sorted files Stuffinc.txt and ThingsLtd.txt, and merge them into a single file named OfficesRUs.txt. Items that are found in both inventory lists should only be written once to the final output file. Additionally, the decision has been made to remove certain items from the current inventory of both stores. These items appear in sorted order in the files, but are preceded by the characters X. (capital X followed by a hyphen). These items should not be written to the merged file, but should instead be stripped of the X- and prefixed by Discons if discontinued from Stuff Inc., or DisconT_ if discontinued from Things Ltd, and output to a file named Discontinued.txt.An example of the files for the two companies and the merged and discontinued files that would result from them is shown below: Stuffinc.txt Binder X-Brown Folder Hole Punch X-Memo Pads Notepad Pencil Pack Rubber Bands x-Scissors-Mega Staples X-Brown Folder Envelopes Manila Folder Notepad Pen set X-Slate Board Sticky Pad Tape Xerographic Paper Binder Envelopes Hole Punch Manila Folder Notepad Pen set Pencil Pack Rubber Bands Staples Sticky Pad Tape Xerographic Paper Discontinued.txt DisconT_Brown Folder DisconS Brown Folder DisconS_Memo Pads DisconT Slate Board DiscS-Scissors-Mega A few things are worth noting: Files are in item sorted order. As an example, the Memo Pads item appears in sorted order within the Stuff Inc. file, but is preceded by the discontinued string X- (i.e., it is sorted as an item than begins with M not X). For output, remove the discontinued string and prepend the string showing which of the original companies discontinued the item (DisconxJ. Items should be written to the discontinued file as they are encountered (they need not be sorted). The discontinued file may contain duplicate items (if the items have been discontinued from both inventories), although they will be prefixed differently
CODE MUST BE IN PYTHON.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started