Question: I want to solve a python 3 program in version 3 . 1 1 Question: Document Merge Programming challenge description: Write a program that will

I want to solve a python 3 program in version 3.11
Question: Document Merge
Programming challenge description:
Write a program that will parse, combine, and output CSV documents. This will require you to work through the data and merge the data sets appropriately based on a unique "ID" identifier for each row.
For example:
ID,Name,Start,End
16,Abraham Lincoln,1861,1865
Merged with:
ID,Name,Start,End
15,James Buchanan,1857,1861
Would result in:
ID,Name,Start,End
15,James Buchanan,1857,1861
16,Abraham Lincoln,1861,1865
Input:
Two CSV-like documents split by an empty line. The first line of each "document" will be the header, with data following afterwards. Each value should always be treated as a string and will be separated by a comma as a control character. Each individual document should only contain unique IDs. The ID value should always be a string with a valid numeric value. The headers of both documents will be consistent. Each document will have at least one row in addition to the header. For example:
ID,Name,Start,End
16,Abraham Lincoln,1861,1865
ID,Name,Start,End
15,James Buchanan,1857,1861
Output:
A single CSV-like document as a result of the provided original documents. The first line should be the header with merged data on subsequent rows, sorted by the ID column. The output should only present one row per unique ID value. If a duplicate ID is provided, use the value in the second document in the results. For example:
ID,Name,Start,End
15,James Buchanan,1857,1861
16,Abraham Lincoln,1861,1865
Test 1
Test Input
Download Test 1 Input
ID,Name,Start,End
16,Abraham Lincoln,1861,1865
ID,Name,Start,End
15,James Buchanan,1857,1861
Expected Output
Download Test 1 Output
ID,Name,Start,End
15,James Buchanan,1857,1861
16,Abraham Lincoln,1861,1865
Test 2
Test Input
Download Test 2 Input
ID,First,Status,Title
541,Tim,Part Time,Accountant
327,Allison,Full Time,Information Security
ID,First,Status,Title
541,Tim,Full Time,Senior Accountant
100,Sally,Full Time,Line Manager
Expected Output
Download Test 2 Output
ID,First,Status,Title
100,Sally,Full Time,Line Manager
327,Allison,Full Time,Information Security
541,Tim,Full Time,Senior Accountant

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!