Discuss / Python / 练习

练习

Topic source
def is_palindrome(n):
    s = str(n)
    for i in range(len(s)//2):
        if s[i] != s[-i-1]:
            return False
    return True

Eugene0_0

#2 Created at ... [Delete] [Delete and Lock User]

会漏掉个位数

```

def is_palindrome(n):

    return str(n) == str(n)[::-1]

```


  • 1

Reply