Discuss / Python / 递归

递归

Topic source

金钟铉

#1 Created at ... [Delete] [Delete and Lock User]
def trim(s):
    if s[:1]==' ':
        return trim(s[1:])
    if s[-1:]==' ':
        return trim(s[:-1])
    return s

  • 1

Reply