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/ Explanation:

Enter a string in mixed case : Read Only Memory

New Word: ROM


Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad