Discuss / Python / 切片

切片

Topic source

金钟铉

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
    while str(n)[:1]==str(n)[-1:]:
        n=str(n)[1:-1]
        if str(n)=="":
            break
    return not str(n) or len(str(n))==1	

  • 1

Reply