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
Use python programming: Capitalise first letter of each word "hello programmer" becomes Hello Programmer. Explain each...
Use python programming: Capitalise first letter of each word "hello programmer" becomes Hello Programmer. Explain each line of code through comments
. Write a function in python that accepts a sentence as the argument and converts each...
. Write a function in python that accepts a sentence as the argument and converts each word to “Pig Latin.” In one version, to convert a word to Pig Latin, you remove the first letter and place that letter at the end of the word. Then you append the string “ay” to the word. Here is an example: English: I SLEPT MOST OF THE NIGHTPIG LATIN: IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY.
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
Programming Language: C How can I add each word in a sentence in to a 2d...
Programming Language: C How can I add each word in a sentence in to a 2d char array? Here's what I have so far: char *text; text = "This is my text"; char wordArray[500][500]; int textLength = strlen(text); --------------- Sample output: This is my text
python program on sonnets to Count the occurrences of each letter in the text.,. Print the...
python program on sonnets to Count the occurrences of each letter in the text.,. Print the number of one-letter, two-letter, three-letter words and so on. and Print the number of occurrences of each different word in the text using  the text from the sonnets.txt file and apply these three metrics
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
Python Programming Build a python programming that asks the user for a three-letter substring. The program...
Python Programming Build a python programming that asks the user for a three-letter substring. The program should then proceed to read the file strings.txt. Each line in strings.txt will contain a string. Your program should then test to see how many non-overlapping occurrences of the three-letter substring occur in that string and test whether the string is a palindrome. The program should then proceed to create an output file string_stats.txt, which contains the original data on one line and the...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT