Hello, long time lurker first time poster. I was looking for some help on a problem I came across on a python site.
I am supposed to count the number of times 'code' apears in my string. But any letter can be in the place of the 'd' in 'code'; 'cofe', 'coqe', ect. I can't figure out how to use a regular expressions, I tried '^co/./$e' but it is not working. Thanks in advance!
I came up with:
x = str.count('code')
print count_code('aaacodebbb') # 1
print count_code('codexxcode') # 2
print count_code('cozexxcope') # 2