Question: Write a program that prompts the user to enter a list of names. Each person's name is separated from the next by a hyphen surrounded

Write a program that prompts the user to enter a list of names. Each person's name is separated from the next by a hyphen surrounded by spaces (" - ") and the names are entered firstName lastName, (i.e. separated by space " " ). Your program should then print out the names, one per line, with the last name followed by the first initial of the first name, followed in turn by "."

A sample run of your program should look like:

Please enter your list of names: Ada Lovelace - Williamina Fleming - Grace Hopper - Annie Easley Lovelace A. Fleming W. Hopper G. Easley A. Thank you for using my name organizer! 

Hint: See Section 10.24 for a quick overview of split(). Do this problem in parts: first, split the list by person (what should the delimiter be?). Then, split each of person's name into first and last name (what should the delimiter be here?). If you have a string str, how do you index to extract the first character? Use Python.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!