Ask Question
29 September, 03:59

9.17 LAB: Name format Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName lastName, and whose output is: lastName, firstName middleInitial. Ex: If the input is: Pat Silly Doe the output is: Doe, Pat S. If the input has the form firstName lastName, the output is lastName, firstName. Ex: If the input is: Julia Clark the output is: Clark, Julia

+1
Answers (1)
  1. 29 September, 04:01
    0
    name=input ("Enter a name: ")

    names = name. split ()

    if

    (len (names) = =3) : middle=names[1] mid=middle[0]. upper () + "." last=names[2]+"," first=names[0] print ('Formatted Name:', last, first, mid) elif (len (names) = =2) : last=names[1]+',' first=names[0]

    print ('Formatted Name:', last, first)

    else:

    print ('The input does not have the correct form')
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “9.17 LAB: Name format Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers