Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Between Markers (simplified) by Julia_Swiatek
def between_markers(text: str, start: str, end: str) -> str:
# your code here
return ""
def between_markers(text, marker1, marker2):
start_index = text.find(marker1) + len(marker1)
end_index = text.find(marker2)
if start_index < end_index:
return text[start_index:end_index]
else:
return ""
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!")
Jan. 18, 2024