first letter of word capital letter

 def capitalize_sentence(sentence):

# Split the sentence into a list of words words = sentence.split() # Capitalize the first letter of each word in the list capitalized_words = [word.capitalize() for word in words] # Join the capitalized words back into a sentence capitalized_sentence = ' '.join(capitalized_words) return capitalized_sentence # Test the function sentence = input("Enter a sentence: ") capitalized_sentence = capitalize_sentence(sentence) print("Capitalized sentence:", capitalized_sentence)

Comments

Popular posts from this blog

Ecommerce website

Yes, Python is an object-oriented programming (OOP) language, but it is also a multi-paradigm language

Your task is to find the missing number.