Below is my totally incompetent attempt. I have written like only 3 codes -- ever. If someone could explain what is wrong with python that it gives me an error, that would be helpful.
from string import *
def countMatches(target,key):
l = []
def checkandmakelist(target,key):
if find(target,key) != -1:
global l
l = l + [str(find(target,key))]
target = target[find(target,key):]
checkandmakelist(target,key)
print len(l)
else:
print "not there"
checkandmakelist(target,key)
countMatches("sfsddfzwefdffe","df")
python 2.7 btw


Sign In
Create Account

Back to top











