Thanks a lot!
I need to learn more about operator precedence in Python, I didn’t know about that
,
Thanks a lot!
I need to learn more about operator precedence in Python, I didn’t know about that
,
I find that this table is always useful.
https://docs.python.org/3/reference/expressions.html#operator-precedence
Hey!
What do you think of this solution?
It seems to work and the task is ticked as correct, but I still have my doubts about it.
# Write your substring_between_letters function here:
def substring_between_letters(word, start, end):
x = word.find(start)
y = word.find(end)
if x and y == -1:
return word
elif x and y != -1:
return word[x+1:y]
# 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"