Question: Help! Please use the python code to do it. Thank you. Question: (1) Complete the get_num_of_characters() function, which takes a string as parameter and returns
Help! Please use the python code to do it. Thank you.
Question:
(1) Complete the get_num_of_characters() function, which takes a string as parameter and returns the number of characters in the user's string. We encourage you to use a for loop in this function.
(2) Implement the output_without_whitespace() function. output_without_whitespace() takes a string as parameter and outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'.
(3) Write a function get_acronym() that returns the acronym for a phrase, e.g. acronym for random access memory is RAM, acronym for central processing unit is CPU.
(4) Create a main() function that first prompts the user to enter a sentence, outputs the string, and calls functions in (1) and (2) to get character counts as well as output without whitespaces; then prompts user again for a phrase and output the acronym.
(4) call the main function to run the program.
A sample input/output dialog
Enter a sentence or phrase: The only thing we have to fear is fear itself.
You entered: The only thing we have to fear is fear itself.
Number of characters: 46
String with no whitespace: Theonlythingwehavetofearisfearitself.
Enter a phrase to generate an acronym: random access memory
The acronym is: RAM
Your program structure should look like:
def get_num_of_characters(inputStr):
#your code here
return
def output_without_whitespace(inputStr) :
#your code here
return
def get_acronym (inputStr) :
#your code here
return
def main () :
#your code here
return
if __name__ == '__main__':
# your code here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
