Write the following three functions A function that accepts a string as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argument is “hello world”, the function returns “Hello World”. Writing the function requires splitting the sentence, then perform a loop on each word and capitalize the character at location zero- You do not need to do this, However, you do NOT need to do that, Python has a ready string method for that, your job is to find it  its easy to use, and saves you plenty of work. It's impossible to know about all Python library functions in a course, but if you look in the Python documentation, you will find what you need.  A function that counts the number of occurrences of given character in a given string. For example, calling the function with Count(‘h’, ‘Hi, Im here’) returns 2. Note the function counts the character regardless of case.   3. A main function, allows the user to enter inputs for the above two functions, calls the functions and displays the results.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Write the following three functions

  1. A function that accepts a string as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argument is “hello world”, the function returns “Hello World”. Writing the function requires splitting the sentence, then perform a loop on each word and capitalize the character at location zero- You do not need to do this, However, you do NOT need to do that, Python has a ready string method for that, your job is to find it  its easy to use, and saves you plenty of work. It's impossible to know about all Python library functions in a course, but if you look in the Python documentation, you will find what you need. 
  2. A function that counts the number of occurrences of given character in a given string. For example, calling the function with

Count(‘h’, ‘Hi, Im here’) returns 2. Note the function counts the character regardless of case.

 

3. A main function, allows the user to enter inputs for the above two functions, calls the functions and displays the results.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT