![Objective: - Read names from two different files into your program and write each name to a single new file. - Download the namelist1.txt and namelist2.txt input files from the assignment page in Canvas and place them in the same folder as your program. - Input files: - nameslist1.txt - nameslist2.txt - Each file contains a list of 200 unique names. - Output file: - Output all names to an output file called allnames.txt - Write a program that reads the names from the two input files and writes the names to the two output files. Steps: a. Ask the user to input the file name and path of the first input file. - Use a try/except block to open all input before processing. - If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path. - Continue looping until the user has entered a valid file name and path. b. Ask the user to input the file name and path of the second input file. - Use a try/except block to open all input before processing. - If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path. - Continue looping until the user has entered a valid file name and path. c. Ask the user to input the file name and path of the output file. - Use a try/except block to open all input before processing. - If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path. - Continue looping until the user has entered a valid file name and path. d. Processing: - Use a try/except block to read from the input files and write to the output file. - Read all the names from one input file at a time. Write the names to the output file. - You must use a while loop to process the first input file (nameslist1.txt) and write to the output file. - You must use a for loop to process the second input file (nameslist2.txt) and write to the output file. - Each line in each input file is one name. - Each name must be written on a separate line in the output file. - There must be no blank lines between names in the output files. e. Close all input files and the output file after all names have been processed. Rubric: The rubric is located on the assignment page in Canvas. Please review the rubric to make sure you meet all of the requirements for this lab. Screen Shot: Enter the path and name of the first file: c:test Terr.txt Error: file(s) not found, or could not be opened. Please reenter. Enter the path and name of the first file: c:testnameslist.1.t.t. Enter the path and name of the second file: c:testerr.txt Error: file(s) not found, or could not be opened. Please reenter. Enter the path and name of the second file: c:testnameslist2.txt Enter the path and name of the output file: c:testallnames.txt Names processing started Names processing complete](https://gotit-pro.com/wp-content/uploads/2023/10/dae5d8bf-3e22-4ca3-9ae6-b16ea2b171d8.png)
Objective:
– Read names from two different files into your program and write each name to a single new file.
– Download the namelist1.txt and namelist2.txt input files from the assignment page in Canvas and place them in the same folder as your program.
– Input files:
– nameslist1.txt
– nameslist2.txt
– Each file contains a list of 200 unique names.
– Output file:
– Output all names to an output file called allnames.txt
– Write a program that reads the names from the two input files and writes the names to the two output files.
Steps:
a. Ask the user to input the file name and path of the first input file.
– Use a try/except block to open all input before processing.
– If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path.
– Continue looping until the user has entered a valid file name and path.
b. Ask the user to input the file name and path of the second input file.
– Use a try/except block to open all input before processing.
– If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path.
– Continue looping until the user has entered a valid file name and path.
c. Ask the user to input the file name and path of the output file.
– Use a try/except block to open all input before processing.
– If the file cannot be opened, display the appropriate error message, and require the user to reenter the file name and path.
– Continue looping until the user has entered a valid file name and path.
d. Processing:
– Use a try/except block to read from the input files and write to the output file.
– Read all the names from one input file at a time. Write the names to the output file.
– You must use a while loop to process the first input file (nameslist1.txt) and write to the output file.
– You must use a for loop to process the second input file (nameslist2.txt) and write to the output file.
– Each line in each input file is one name.
– Each name must be written on a separate line in the output file.
– There must be no blank lines between names in the output files.
e. Close all input files and the output file after all names have been processed.
Rubric: The rubric is located on the assignment page in Canvas. Please review the rubric to make sure you meet all of the requirements for this lab.
Screen Shot:
Enter the path and name of the first file: c:\test Terr.txt
Error: file(s) not found, or could not be opened. Please reenter.
Enter the path and name of the first file: c:\test\nameslist.1.t.t.
Enter the path and name of the second file: c:\test\err.txt
Error: file(s) not found, or could not be opened. Please reenter.
Enter the path and name of the second file: c:\test\nameslist2.txt
Enter the path and name of the output file: c:\test\allnames.txt
Names processing started
Names processing complete
![](https://gotit-pro.com/wp-content/uploads/2021/05/info.png)