Write a Python function called name_processor that takes a list of students' full names and returns a new list containing the names in the format "Last, First". You can assume that the list contains only strings and that the strings are not empty. In the original list, first and last names are separated by a space e.g. "First Last". Some full names may contain a middle name e.g. "First Middle Last". In these cases, ignore the middle name. It is possible that a student has only a single name (i.e. one word, no spaces). In these cases, add the name to the new list without changing its format. An example: Calling the function with this list: ["Pele", "Sarah Jessica Parker", "Darth Vader"] ... should return this list: ["Pele", "Parker, Sarah", "Vader, Darth"] You will find the string method .split() useful for this problem
Write a Python function called name_processor that takes a list of students' full names and returns a new list containing the names in the format "Last, First". You can assume that the list contains only strings and that the strings are not empty. In the original list, first and last names are separated by a space e.g. "First Last". Some full names may contain a middle name e.g. "First Middle Last". In these cases, ignore the middle name. It is possible that a student has only a single name (i.e. one word, no spaces). In these cases, add the name to the new list without changing its format.
An example:
Calling the function with this list: ["Pele", "Sarah Jessica Parker", "Darth Vader"]
... should return this list: ["Pele", "Parker, Sarah", "Vader, Darth"]
You will find the string method .split() useful for this problem.
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)