Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short solution in Clear category for Between Markers (simplified) by PistoleroAlan
between_markers=lambda text,start,end:text[text.index(start)+1:text.index(end)]
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!")
Aug. 22, 2023
Comments: