Count occurrences characters in Python String

preview_player
Показать описание
In this video we will talk about How to Count occurrences of characters in Python String.

Important Links:
#Python
#Numpy
#Pandas
Рекомендации по теме
Комментарии
Автор

what is it for??? what is Occurrences of substring python??

pro.empire
Автор

CAD = "algoritmo"
CHAR = 'o'
steps = []

def steps_till_char(CAD, CHAR, i, steps, count, step):
if i >= len(CAD):
return steps
if CAD[i] != CHAR:
count = 0
step += 1
steps.append(count)
else:
steps.append(step)
step = 0
return steps_till_char(CAD, CHAR, i+1, steps, count, step)
print(steps_till_char(CAD, CHAR, 0, steps, 0, 0))

kvelez
Автор

A str object is not iterable. This is not supposed to work

rcl_