Pull Out the Tag

Python for AIMedium+10 XP+10

Pull Out the Tag

Order messages hide a code between two markers, like #A42# or <b>bold</b>.

Task: write between(text, start_marker, end_marker) that returns the text between the first start_marker and the first end_marker that comes after it.

  • If start_marker isn't in text, return "".
  • If there is no end_marker after the start marker, return "".
  • The markers can be more than one character long.

Examples

text = "Order #A42# shipped"
start_marker = "#"
end_marker = "#"
returns 'A42'
text = "<b>bold</b> text"
start_marker = "<b>"
end_marker = "</b>"
returns 'bold'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run