So I am needing to count the number of times a given value occurs in a string, such as "hello world" , "o", however my maximum depth is getting exceeded...I should aslo not I would like to do this recursively
def count(s, token) : #OUT OF RANGE
if len(s) == 1 and s[0] == token :
return 1 + count(s[1:], token)
#return s[0]
else :
return count(s[1:],token)
in main I have
print(count('hello world' , 'o'))