from functools import reduce def is_palindrome(n): def fn(x,y): return x*10+y L = [] for i in str(n): L.append(i) b = list(map(int,L)) if len(L) == 1: return b else: for i in range(int(len(L)/2)): if L[i] == L[-i-1]: return (reduce(fn,b))
Sign in to make a reply
小神CaT