Discuss / Python / If it's range between 1~1000, it can be:

If it's range between 1~1000, it can be:

Topic source

def is_palindrome(n):

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

像题目说的一样,只适用于3位数,因为只判断了首尾


  • 1

Reply