Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created March 10, 2020 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/08280e76917c5736c0e4a0ba20025c55 to your computer and use it in GitHub Desktop.
Save codecademydev/08280e76917c5736c0e4a0ba20025c55 to your computer and use it in GitHub Desktop.
Codecademy export
# Write your count_multi_char_x function here:
def count_multi_char_x(word, phrase):
wc = 0
y=word.find(phrase)
if y > -1:
x=y+3
wc += 1
yeniword =word[x:]
z = yeniword.find(phrase)
if z > -1:
wc += 1
return wc
#word = "mississippi"
#y = word.find("iss")
#x = y + 3
#yeniword = "mississippi"[x:]
#y2 = yeniword.find("iss")
#x = y2 + 3
# Uncomment these function calls to test your function:
print(count_multi_char_x("mississippi", "iss"))
# should print 2
print(count_multi_char_x("apple", "pp"))
# should print 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment