To find the number of occurrences of a character in a given string, we will iterate through the string and create a counter for the character. Whenever the iteration results in a match with the character, we will increment this counter by 1. This can be implemented in python as –  input_string = “coding interview preparation”
input_string = input_string.lower()
character = ‘i’
str_length = len(input_string)
char_count = 0
for idx in range(0, str_length):
if input_string[idx] == character:
char_count += 1
print(f‘There are {char_count} occurrences of {character} in the input string’)  The output of the above program will be “There are 4 occurrences of i in the input string”.