Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Between Markers (simplified) by Evgenij_Ivanov259
def between_markers(text: str, start: str, end: str) -> str:
h = text.index(start)
result = text[h + 1:text.index(end)]
return result
between_markers("[an apple]", "[", "]")
print("Example:")
print(between_markers("What is >apple<", ">", "<"))
# These "asserts" are used for self-checking
assert between_markers("What is >apple<", ">", "<") == "apple"
assert between_markers("What is [apple]", "[", "]") == "apple"
assert between_markers("What is ><", ">", "<") == ""
assert between_markers("[an apple]", "[", "]") == "an apple"
print("The mission is done! Click 'Check Solution' to earn rewards!")
May 13, 2025