Light Mode
Dark Mode
try find answer

i thing i task solved but second answer like "Htlm, No opened, One sym" do i need check answer od print this ? example apple is my answer but "one sym" is also answer?

def between_markers(text: str, begin: str, end: str) -> str:
    x=text.find(begin)
    if x != 0:
        y = text.find(end)
        if y!= 0:
            return text[x+1:y]
         #znaleziony poczatek
    else:#1
        y = text.find(end)
        if y<begin:
                print('')
            if y!=0:
                return text[0:y]
            else:#2
                return text[0:+1]#3


    if __name__ == '__main__':
        print('Example:')
        print(between_markers('What is >apple<', '>', '<'))

    # These "asserts" are used for self-checking and not for testing
    assert between_markers('What is >apple<', '>', '<') == "apple", "One sym"
Created: June 1, 2020, 10:20 a.m.
Updated: Nov. 15, 2020, 10:03 a.m.
0
8
User avatar
Mateu52