Discuss / Python / HomeWork

HomeWork

Topic source

def trim(str): bol = True bol_2 = True while(bol or bol_2): if(str[0] == " "): str = str[1:] bol = True else: bol = False

    if(str[-1] == " "):
        str = str[0:-1]
        bol_2 = True
    else:
        bol_2 = False

return str

  • 1

Reply