John Nagle <na...@animats.com> writes: > On 9/30/2010 7:12 PM, Geo_subodh wrote: >> 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. > > def ispalin(s) : > s = str(s) > n = len(s) / 2 > return(s[:n] == s[::-1][:n])
return s.startswith(s[n:][::-1]) You'll save valuable time when deploying your palindrome checking system and it has to check trillions of palindromes an hour :) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list