I’m having issues understanding Question # 4 Count Multi- X in the String Methods Code Challenge. I was struggling with this problem quite a bit and I looked at the solution to see how far off my answer was. Here’s the solution
def count_multi_char_x(word, x):
splits = word.split(x)
return(len(splits)-1)
If you enter this in:
print(count_multi_char_x(“mississippi”, “iss”))
Why does it give you 2?
wouldn’t splits = [‘m’, ‘ippi’] so the length of splits would be 2 - 1 would be 1…so why is this printing 2?