Can I have some help making a program that has the user append 5 names into a list using a loop? The names need to be in the format LastName-FirstName, with the – separating first/last. Then, using a second loop, split each name based on -.
Can I have some help making a
![](/static/compass_v2/shared-icons/check-mark.png)
1. Create an empty list called names_list.
2. Create an empty list called split_names_list.
3. Use a loop to repeat the following steps 5 times:
a. Prompt the user to enter a name in the format "LastName-FirstName" and store it in a variable called name.
b. Append the name to the names_list.
4. Use a loop to iterate over each name in names_list:
a. Split each name based on the '-' character and store the resulting last name and first name in variables.
b. Create a tuple containing the last name and first name.
c. Append the tuple to the split_names_list.
5. Print "Split Names:" to the console.
6. Use a loop to iterate over each tuple in split_names_list:
a. Print the last name and first name in the format "Last Name: [last_name], First Name: [first_name]" to the console.
7. End the program.
Step by step
Solved in 3 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)