Created
December 29, 2020 02:52
-
-
Save mightywombat/2eb78e8345d3bc3e6900410adcd85d49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_substring(string, sub_string): | |
count = 0 | |
for i, value in enumerate(string): | |
if string[i:i+len(sub_string)] == sub_string: | |
count += 1 | |
return count | |
#print("match at string[" + str(i) + "]") | |
if __name__ == '__main__': |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment