Discuss / Python / 尝试一下

尝试一下

Topic source

Seayon阿阳

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):    c = str(n)    l = len(c)    for x in range(l):        print(c[x:x + 1] + c[l - x - 1])        if l / 2 == x and c[x:x + 1] == c[l - x - 1]:            return True        if c[x:x + 1] != c[l - x - 1]:            return False    return True

  • 1

Reply