Discuss / Python / Homework

Homework

Topic source

Ethan-Fanny

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

#--------Solution 1---- def is_palindrome(n): new = list(str(n)) new.reverse() return n == int(''.join(new)) output = filter(is_palindrome, range(1, 1000)) print(list(output))

#--------Solution 2---- def is_palindrome(n): return n == int((str(n)[::-1])) output = filter(is_palindrome, range(1, 1000)) print(list(output))


  • 1

Reply