Programming Examples

Python program to form a word by joining first character of each word


Write a Python code to enter a sentence. Form a word by joining all the first characters of each word of the sentence. Display the word.

Sample Input: Read Only Memory

Solution:

wd=""
str=input("Enter a string in mixed case : ")
str=" "+str
p=len(str)
for i in range(0,p):
       if(str[i]==' '):
               wd=wd+str[i+1]
print("New Word:",wd)
Output

Enter a string in mixed case : Read Only Memory

New Word: ROM


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad