0
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)
10 Réponses
+ 5
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.
+ 3
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 )
+ 3
text = input()
letter = input()
def letter_count(text, letter):
x=text.count(letter)
return x
print(letter_count(text, 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)
👍
+ 1
text = str(input())
letter = str(input())
def letter_count():
print(text.count(letter))
letter_count()
0
Ipang it did not work ,it gave no output
0
Show me updated code bro
0
Ok good job! 👍
0
def letter_count(text, letter):
x=text.count(letter)
return x
text = input()
letter = input()
print(letter_count(text, letter))