Question: Python 3: Write a function CharCount, to take a string S and a single character C, and returns the count of C (one letter) in

Python 3:

Write a function CharCount, to take a string S and a single character C, and returns the count of C (one letter) in the string S. If the letter of C is not found in S, the function returns -1. You must write your own function to do this and can not use any built-in counting functions.

Use the function in main to get two inputs from the user, a sentence and a character, then show the count of that character or an error message if the count is -1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!