Question

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

Homework Answers

Answer #1

Code:

word = "hello programmer"
parts = word.split() #this will create list of words separated by spaces
for i in range(len(parts)): #iterating each word in parts array
    parts[i] = parts[i].capitalize() #capitalizing each word 1st letter 

listToStr = ' '.join([str(elements) for elements in parts]) #converting list back to string using join function 
print(listToStr) 

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 in a sentence
Use python programming: Capitalise first letter of each word in a sentence
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...
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
Use the Python programming language to complete below (I need the New Answer for this, and...
Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!): Write a program to input an uncertain string S of words and space/tab Remove space/tab in S Remove identical words Sort all words in the order of a-z Print the output strings Example: Input String: "hello world and practice makes perfect and hello world again" Output String: "again and hello makes perfect practice world"...
Python Jupyter Notebook An acronym is a word formed by taking the first letters of the...
Python Jupyter Notebook An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, RAM is an acronym for "random access memory." Write a program that allows the user to type in a phrase and then outputs the acronym for that phrase. Note : The acronym should be all uppercase, even if the words in the phrase are not capitalized ### Complete the algorithm (Can be...
THIS PYTHON PROGRAMMING On a chessboard, positions are marked with letters between a and h for...
THIS PYTHON PROGRAMMING On a chessboard, positions are marked with letters between a and h for the column and a number between 1 and 8 for the row. The first place on the board, a1, is black. The next is white, alternating across a row. Odd rows start with black, even rows start with white. Given a 2 character input string with a letter (a-h) and a number (1-8), print "Black" or "White" indicating if the square is black or...
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python...
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python program using the Python IDE based on recursion with trees that is both depth first and breadth first searches. The Python program to be developed will demonstrate the use of both depth-first (DFS) and breadth-first (BFS) searches. A tree node structure will be developed that will be used both for DFS and BFS searches. The program will apply recursion both for the DFS and...
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first,...
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first, third, fifth (and so on) characters of the strings, with each character both preceded and followed by the ^ symbol, and with a newline appearing after the last ^ symbol. The function returns no value; its goal is to print its output, but not to return it. Q2) Write a Python function called lines_of_code that takes a Path object as a parameter, which is...
Using the code as an example, explain why Python is a fixed format programming language. Describe...
Using the code as an example, explain why Python is a fixed format programming language. Describe what would be output for each of the print statements in the code listing.- Given the difference in output, explain the different roles of readLine(), readLines(), and read() functions. with open("rainfall.txt","r") as inFile:    aLine = inFile.readLine() with open("rainfall.txt", "r") as inFile:   lineList = inFile.readLines() with open("rainfall.txt", "r") as inFile:   fileString = inFile.read()) print(aLine) print(lineList) print(fileString)
WRITE USING PYTHON PROGRAMMING THE CODE GIVEN BELOW HAS SOME ERRORS WHICH NEED TO BE SOLVED....
WRITE USING PYTHON PROGRAMMING THE CODE GIVEN BELOW HAS SOME ERRORS WHICH NEED TO BE SOLVED. ALSO THE 2 POINTS MENTIONED BELOW SHOULD BE PRESENT IN THE CODE Write a script that calculates the 3 longest words of a text stored in a file and print them from the longest to the smaller of the 3. Please note: 1. The name of the file is word_list.csv and it doesn’t need to be asked to the user (meaning the name will...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT