+ 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 Answer
0
'hello friend'.count('e')
2nd Feb 2018, 1:13 AM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar