Geo_subodh said:
please send me the simple python code that uses input number greater
than3 digits(>3 digits) and checks whether the number is palindrome
or not.
The following works without using strings (although leading zeros are
ignored, so that 01210 returns False):
def fpalindrome(n):
if n<0: return False
if n<10: return True
digits=1
a=n
while a>=10:
digits=digits+1
a=a//10
lastdigit=n%10
firstdigit=n//(10**(digits-1))
if firstdigit!=lastdigit: return False
if digits==2: return True
middledigits=n//10-firstdigit*(10**(digits-2))
return fpalindrome(middledigits)
print fpalindrome(12345678987654321)