7.1.5 Codehs:
Write a program that gets a string containing a person's first, middle and last names, and then display their first, middle and last initials. For example, if the user enters John William Smith, the program should display J. W. S. [In python]
Answer:
first = input("First name: ")
middle = input("Middle name: ")
last = input("Last name: ")
print(first[0]+". "+middle[0]+". "+last[0]+".")
Explanation:
This line prompts user for first name
first = input("First name: ")
This line prompts user for middle name
middle = input("Middle name: ")
This line prompts user for last name
last = input("Last name: ")
This line prints the name initials
print(first[0]+". "+middle[0]+". "+last[0]+".")