Question: Create a Python program that:Create a file and write data containing a list of names separated by a comma. The program will receive the first

Create a Python program that:Create a file and write data containing a list of names separated by a comma. The program will receive the first name and last name data from the user and save them to appropriate variables. Once the names are separately saved, a function will concatenate the names so that they are in the last name, first name order; returning the result to an appropriate variable. This result will be put into a list and then written into a file.Follow the outline below strictly, including the variable names. This code builds upon the demo code and will help you identify how to use demo code or video to solve assignments.Complete the portions with the question marks (i.e.,..?)#A. Create and initialize the variables necessary for the program. See the demo code for a hint.fName =? #First NamelName =? #Last NamewholeName =..? #Last name & first namemoreNames =?#Loop control variable.userResponse =?#User response to whether there are more itemsnameFile =? #Variable for the output file nameNameList =.?#List object#B. Creates the function that will concatenate the names? .?.?"""see the demo code/video for a hint on how to create a Name Function: The Name Function must receive the first and last names and return them as a single item in the last name, first name order"""#C. Ask the User for the name of the output file they wish to create'''nameFile =? D. Prompt the user to enter a first name and last name and add the names to the list. Ask the user if they have more names to enter and stop the loop when the user does not wish to add more names. Use the if statement to test the users response. Make sure the loop is properly indented. while moreNames == "Yes": fName = input("Please enter the person's first name: ") lName = input("Please enter the person's last name: ") wholeName =..? #Call the function and place the results in a variable ..? #Add name to the list. See demo code for hint. userResponse = input("Would you like to enter more names (Y/N)?") if userResponse.upper()=="N": #Checks the user reply for an N for no by converting to uppercase moreNames ="No"#E. Open output file. That is, open the file that you have created.nameFile +=".txt"outputFile =..?#F. Write list contents to filefor ..? in ..?: outputFile?(?+"
")#G. Close file?

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 Databases Questions!