Trying to solve how many letter | Sololearn: Learn to code for FREE!


Trying to solve how many letter

Only one test case comes out right text =str(input()) letter =str(input()) keg=letter.count(text) print(keg)

4/7/2021 11:51:30 AM

Simisola Osinowo

7 Answers

New Answer


Write a function that takes a string and a letter as its arguments and returns the count of the letter in the string. Sample Input hello, how are you? o Sample Output 3 Explanation: The letter o appears 3 times in the given text.


Looking at the example, <text> was "hello, how are you?", and <letter> was "o". I think you are supposed to count frequency of <letter> inside <text>, and not the other way around. So you need this instead keg = text.count( letter )


Ipang sorry it worked Thanks


t=input() l=input() def lc(t,l): c=t.count(l) print(c) lc(t,l) 👍


Ipang it did not work ,it gave no output


Show me updated code bro


Ok good job! 👍