WriteaPythonprogramthataskstheusertoenterfullnameinthefollowingformat:LastName,FirstNameMiddleName(forExample:"Hun,AttilaThe”).Theinputwillhaveasinglespaceafterthecommaa...
Write a Python program that asks the user to enter full name in the following format:
LastName, FirstName MiddleName
(for Example: "Hun, Attila The”).
The input will have a single space after the comma and only a single space between the first name and the middle name. Use string methods and operators in Python to convert this to a new string having the form:
FirstName MiddleInitial Period LastName (for example: "Attila T. Hun") and output it.
Be sure to test it with more than one input and not just "Hun, Attila The".
Sample Output 1:
Enter name in [LastName, FirstName MiddleName] format >Newton, Sir Isaac
The new name is : Sir I. Newton
Sample Output 2:
Enter name in [LastName, FirstName MiddleName] format >Hun, Attila The
The new name is : Attila T. Hun
展开