-
-
Save codecademydev/08280e76917c5736c0e4a0ba20025c55 to your computer and use it in GitHub Desktop.
Codecademy export
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
# 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