You are viewing a single comment's thread. Return to all comments →
def count_substring(string, sub): count = 0 longsub = len(sub) compare = "" concidence = 0 for i in string: count += 1 compare += i
if count == longsub: if compare == sub: concidence += 1 compare = compare[1:] count -=1 return concidence
Seems like cookies are disabled on this browser, please enable them to open this website
Find a string
You are viewing a single comment's thread. Return to all comments →
def count_substring(string, sub): count = 0 longsub = len(sub) compare = "" concidence = 0 for i in string: count += 1 compare += i