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

+1

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

+3

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.

+2

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 )

+1

Ipang sorry it worked Thanks

+1

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

0

Ipang it did not work ,it gave no output

0

Show me updated code bro

0

Ok good job! 👍