-
-
Save codecademydev/f16f0b3c9eb61a1a6ccde34149ed53fd 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 substring_between_letters function here: | |
def substring_between_letters(word, start, end): | |
begain = word.find(start) | |
last = word.find(end) | |
if begain == -1 or last == -1: | |
return word | |
else: | |
return word[(begain+1):last] | |
# Uncomment these function calls to test your function: | |
print(substring_between_letters("apple", "p", "e")) | |
# should print "pl" | |
print(substring_between_letters("apple", "p", "c")) | |
# should print "apple" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment