Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_occurences(s, sub):
- if len(s) == 0:
- return 0
- else:
- ind = s.find(sub)
- if ind>=0:
- return 1+count_occurences(s[ind+1:], sub)
- else:
- return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement