Question

Use python programming: Capitalise first letter of each word in a sentence

Use python programming: Capitalise first letter of each word in a sentence

Homework Answers

Answer #1

Python code:

#accepting the sentence and converting it into a list of words
sentence=input().split()
#capitalizing each word and converting it back to string
capitalized=" ".join([i.capitalize() for i in sentence])
#printing the capitalized string
print(capitalized)

Screenshot:


Input and Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create program that sorts words of a string based on first letter of each word. Use...
Create program that sorts words of a string based on first letter of each word. Use C programming language. - Only use stdio.h and string.h - Remove any newline \n from input string - Use insert function - Input prompt should say "Enter string of your choice: " - Output should print sorted string on new line Example:     Enter string of your choice: this is a string     a is string this
how can I use regex to find a word containing the letter 'a' but it is...
how can I use regex to find a word containing the letter 'a' but it is not followed by the letter 'b'. python
PYTHON WITHOUT def function Given two inputs: a sentence and a word to be censored. Print...
PYTHON WITHOUT def function Given two inputs: a sentence and a word to be censored. Print out a new sentence with the word censored. In place of the censored word, print "*******", where the number of * characters match the length of the word. The program should censor the exact casing of the word. Sample Input Pysics is very hard!I'm very ready! Im very excited Sample Output Pysics is **** hard!I'm **** ready! Im **** excited
PYTHON without def function Given two inputs: a sentence and a word to be censored. Print...
PYTHON without def function Given two inputs: a sentence and a word to be censored. Print out a new sentence with the word censored. In place of the censored word, print "*******", where the number of * characters match the length of the word. The program should censor the exact casing of the word. Sample Input Pysics is very hard!I'm very ready! Im very excited Sample Output Pysics is **** hard!I'm **** ready! Im **** excited
Write a function that accepts a line of text and a single letter as input (case...
Write a function that accepts a line of text and a single letter as input (case insensitive) and returns the number of times the letter is the first character of a word. Note your program should be able to handle different cases. And check if the user input is a single letter. Example: Input text = "When the SUN rises at dawn, the chicken flies into the window." Input letter = "t" Output = "The letter t has appeared 3...
Consider the letter K. Is the letter K more likely to be the first letter in...
Consider the letter K. Is the letter K more likely to be the first letter in a word or the third letter in a word? Why do you think your answer is true?
Create a Python program that: Allows the user to enter a phrase or sentence. The program...
Create a Python program that: Allows the user to enter a phrase or sentence. The program should then take the phrase or sentence entered Separate out the individual words entered Each individual word should then be added to a list After all of the words have been place in a list Sort the contents of the list Display the contents of the sorted list with each individual word displayed on a separate line Display a message to the user indicating...
make a python dictionary that counts the number of times each letter occurs in the the...
make a python dictionary that counts the number of times each letter occurs in the the book below book_url = 'http://www.gutenberg.org/cache/epub/2680/pg2680.txt'
Each letter of the word “supercalifragilisticexpialidocious” is placed into a bag and drawn at 3 times,...
Each letter of the word “supercalifragilisticexpialidocious” is placed into a bag and drawn at 3 times, replacing the letter after each draw. Find the probability that the letter "i" is drawn at least once. Round your answer to two decimal places. Please help. Thanks!
Hello, I am trying to write a program in python that will determine if a sentence...
Hello, I am trying to write a program in python that will determine if a sentence has every letter in the alphabet, regardless if it is upper or lower case. The program needs to indicate if all letters are present or not, and print out the missing letters if there are any. Thanks for any help in advance.