Ask Question
16 January, 23:10

write a program that prompts the user to enter a list of names. each person's name is separated from the next by a semi-colon and a space ('; ') and the names are entered lastname, firstname (i. e. separated by ', '). your program should then print out the names, one per line, with the first initial of the first name, followed by ".", and followed by the last name.

+3
Answers (1)
  1. 17 January, 01:49
    0
    names = input ()

    names = names. split ('; ')

    for name in names:

    splited_name = name. split (',')

    print (splited_name[1][0], '.', splited_name[0])

    Explanation:

    I'm gonna give you a answer in python, and explane each line next

    Step 1: Read the string of names

    names = input ()

    Step 2: Get splited each name by semicolon '; '

    names = names. split ('; ')

    Step 3: Loop in all names

    for name in names:

    Step 4: Get a name and last name splited:

    splited_name = name. split (',')

    Step 5: Print the first character of the name with '.' and the last name

    print (splited_name[1][0], '.', splited_name[0])
Know the Answer?
Not Sure About the Answer?
Find an answer to your 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 semi-colon and a space ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers