Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started