Ask Question
28 April, 17:48

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

+1
Answers (1)
  1. 28 April, 17:58
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers