I am trying to search for the sum of occurances of a substring within a string:
string = 'ABCDCDC'
sub_string = 'CDC'
for i in range(len(string)-len(sub_string)):
print(string[i:len(substring)]
I am unsure why this is my output:
ABC
BC
C
Should'nt it be:
ABC
BCD
CDC
DCD
CDC