+ 1

Counting occurrence of character python

In python, what is the simplest way to count the occurrence of the character ‘e’ in the string “hello friend”? I tried using .count but i’m not sure how to use it

2nd Feb 2018, 12:16 AM
Nick DiPaolo
Nick DiPaolo - avatar
1 Réponse
0
'hello friend'.count('e')
2nd Feb 2018, 1:13 AM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar