Discuss / Python / 我觉得这样子逻辑更清晰一些

我觉得这样子逻辑更清晰一些

Topic source

gylpnj

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
    s = str(n)
    return s == s[::-1]

转换成字符串, 不需要涉及到数字的计算和比较

代代树

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

好简洁~


  • 1

Reply