Question: The list names where each element is a string in First Name Last Name sequence. Derive a new list from names where the string is
The listnameswhere each element is a string in "First Name Last Name" sequence. Derive a new list fromnameswhere the string is in "Last Name, First Name" sequence. Use list comprehension to convert the list.
names = ["Isaac Newton", "Albert Einstein", "Niels Bohr", "Marie Curie","Charles Darwin", "Galileo Galilei", "Margaret Mead"]
Output should be:
['Newton, Isaac', 'Einstein, Albert', 'Bohr, Niels', 'Curie, Marie', 'Darwin, Charles', 'Galilei, Galileo', 'Mead, Margaret']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
