Question: Requirements: build a function that can find all the occurrences of a character in a string. The function should be named find _ a _

Requirements: build a function that can find all the occurrences of a character in a string.
The function should be named find_a_char() and takes two parameters: the first one takes
in the string and the second one takes in the character to be found. Use find_a_char("Bobby
had the bat at the second base", 'b') to test your function. The output should be formatted
like:
#1 @index 2
#2 @index 3
Hint: You may use a while-loop to continue checking to the end of the string, and use string
method find() to locate the indexes of the character in the string. Or you can use a for-loop
to keep checking the string character by character and check if it is the same as the second
parameter.
 Requirements: build a function that can find all the occurrences of

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!