Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 27, 2020 18:46
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/ef36042604ccf38357eb90cb21449872 to your computer and use it in GitHub Desktop.
Save codecademydev/ef36042604ccf38357eb90cb21449872 to your computer and use it in GitHub Desktop.
Codecademy export
# Write your substring_between_letters function here:
def substring_between_letters(word, start, end):
return word[word.find(start) + 1: word.find(end)] if start in word and end in word else word
# 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