Ask Question
6 May, 15:26

Count characters Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times the character appears in the phrase. Ex: If the input is: n Monday

+4
Answers (1)
  1. 6 May, 17:13
    0
    str1=str (input ("Enter a character and phrase "))

    count = 0

    for i in range (0, len (str1)):

    if str1[0]==str1[i]:

    count+=1

    count1=count-1

    print (str1[0] + ' appears ' + 'this many times in ' + str1[1:] + ' is : ' + str (count1))
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Count characters Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers