Discuss / Python / 回文数-C语言思路

回文数-C语言思路

Topic source

岁益寒

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

# -*- coding: utf-8 -*-

# C语言思路

def is_palindrome(n):

    s=str(n)

    length=len(s)

    for n in range(length):

        if s[n] != s[length-n-1]:

            return False

    return True

it = filter(is_palindrome,range(1,200))

print(list(it))


  • 1

Reply