subject

Using a for loop, write a function lastfirst() that takes a list of strings as a parameter. Each string in the list has the format 'Last, First' where Last is a last name and First is a first name. You should assume that there are no spaces between the last name and the comma and that there are an arbitrary number of spaces between the comma and the first name. The function lastfirst() returns a list containing two sub lists. The first sub list is a list of all the first names and the second sub list is a list of all the last names. The following shows how the function would be called on two example parameters:>>> lastfirst(['Lulis, Evelyn', 'Jones, Tom', 'Presley, Elvis', 'Sumner, Gordon'])[['Evelyn', 'Tom', 'Elvis', 'Gordon'], ['Lulis', 'Jones', 'Presley', 'Sumner']]>>> lastfirst(['Ford, Harrison', 'Hepburn, Katharine', 'Tracy, Spencer'])[['Harrison', 'Katharine', 'Spencer'], ['Ford', 'Hepburn', 'Tracy']]

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:10
Write an application that allows a user to enter the names and birthdates of up to 10 friends. continue to prompt the user for names and birthdates until the user enters the sentinel value “zzz” for a name or has entered 10 names, whichever comes first. when the user is finished entering names, produce a count of how many names were entered, and then display the names. in a loop, continuously ask the user to type one of the names and display the corresponding birthdate or an error message if the name has not been previously entered. the loop continues until the user enters “zzz” for a name. save the application as birthdayreminder.java.
Answers: 1
question
Computers and Technology, 21.06.2019 22:00
Which one of the following identifies the primary a purpose of information classification processes? a. define the requirements for protecting sensitive data.b. define the requirements for backing up data.c. define the requirements for storing data.d. define the requirements for transmitting data.
Answers: 2
question
Computers and Technology, 22.06.2019 02:00
What is the largest decimal number that can be represented by a binary number with 4 place values? (remember, each place in a binary number has a value of a power of 2, starting in the ones place with 20.)
Answers: 3
question
Computers and Technology, 22.06.2019 04:00
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
You know the right answer?
Using a for loop, write a function lastfirst() that takes a list of strings as a parameter. Each str...
Questions
question
Computers and Technology, 09.09.2019 19:30
question
Mathematics, 09.09.2019 19:30
question
Chemistry, 09.09.2019 19:30
question
History, 09.09.2019 19:30
Questions on the website: 13722362