Counting occurrence of character python | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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 ответ
0
'hello friend'.count('e')
2nd Feb 2018, 1:13 AM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar