Computer Science > QUESTIONS & ANSWERS > #You've been sent a list of names. Unfortunately, the names #come in two different formats: (All)
#You've been sent a list of names. Unfortunately, the names #come in two different formats: # #First Middle Last #Last, First Middle # #You want the entire list to be the same. For this problem,... #we'll say you want the entire list to be Last, First Middle. # #Write a function called name_refixer. name_refixer should take #as input the list of strings. You may assume that every string #will match one of the two formats above: either First Middle Last #or Last, First Middle. # #name_fixer should return a list of names all structured as #Last, First Middle. If the name was already structured as #Last, First Middle, it should remain unchanged. If it was #structured as First Middle Last, then Last should be moved #to the beginning and a comma should be added after it. # #The names should appear in the same order as the original list. # #For example: # #name_list = ["David Andrew Joyner", "Hart, Melissa Joan", "Cyrus, Billy Ray"] #name_fixer(name_list) -> ["Joyner, David Andrew", "Hart, Melissa Joan", "Cyrus, Billy Ray"] #Add your code here! #Below are some lines of code that will test your function. #You can change the value of the variable(s) to test your #function with different inputs. # #If your function works correctly, this will originally #print: #["Joyner, David Andrew", "Hart, Melissa Joan", "Cyrus, Billy Ray"] name_list = ["David Andrew Joyner", "Hart, Melissa Joan", "Cyrus, Billy Ray"] print(name_refixer(name_list)) [Show More]
Last updated: 2 years ago
Preview 1 out of 2 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Nov 09, 2022
Number of pages
2
Written in
This document has been written for:
Uploaded
Nov 09, 2022
Downloads
0
Views
72
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·