human
Write me a code to program to print the initials of a name with the surname and the other steps required given the following:
Program to print the initials of a name with the surname | Python program to print the initials of a name with the surname.
to remove any leading or trailing spaces.
to store extracted words.
forming the word.
when space is encountered it means the name is completed and thereby extracted.
printing the first letter of the name in capital letters.
for the surname , we have to print the entire surname and not just the initial string " t " has the surname now.
first letter of surname in capital letter.
rest of the letters in small.
printing surname.
Driver Code"
Solution in Python:
assistant
#Here is code to program to print the initials of a name with the surname and the other steps required.
 def printInitials ( string : str ) :
	length = len ( string )
	string . strip ( )
	t = " "
	for i in range ( length ) :
		ch = string [ i ]
		if ch != ' ▁ ' :
			t += ch
		else :
			print ( t [ 0 ] . upper ( ) + " . ▁ " , end = " " )
			t = " "
	temp = " "
	for j in range ( len ( t ) ) :
		if j == 0 :
			temp += t [ 0 ] . upper ( )
		else :
			temp += t [ j ] . lower ( )
	print ( temp )
if __name__ == " _ _ main _ _ " :
	string = " ishita ▁ bhuiya "
	printInitials ( string )