Discuss / Python / 作业

作业

Topic source

FJ-W97

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

def is_palindrome(n): str1 = list(str(n)) str2 = [] i = 1 for x in str1: str2.append(str1[len(str1) - i]) i += 1

return str2 == str1

output = filter(is_palindrome, range(1, 1000)) print(list(output))


  • 1

Reply