Discuss / Python / 哎 简单粗暴

哎 简单粗暴

Topic source

tycoonBrain

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

def is_palindrome(n):

        L = str(n)

        a = len(L)

        b = len(L) % 2

        return a ==1 or (a > 1 and b==0 and L[:a//2] == L[-a//2:]) or (a >1  and b==1 and L[:(a-1)//2] == L[(-(a-1))//2:])

陈Geoffrey

#2 Created at ... [Delete] [Delete and Lock User]
'str' object is not callable

  • 1

Reply