Computer Science, asked by haksqw1234, 3 days ago

Write a program to count the number of times a character appears in a given string.​

Answers

Answered by patariyaharshida
7

Answer:

str = input("Enter the string: ")

ch = input("Enter the character to count: ");

c = str.count(ch)

print(ch, "occurs", c, "times")

Explanation:

Enter the string:

Enter the character to count: e

e occurs 2 times

Similar questions