Checking a Number for Palindromic Behavior

gslindstrom gslindstrom at
Mon Oct 19 17:49:09 CEST 2009

On Oct 18, 5:56 pm, Gary Herron <gher... at> wrote:
> Benjamin Middaugh wrote:
> > Thanks to everyone who helped with my query on reversing integers. I
> > have one more simple problem I'm having trouble solving. I want to
> > check a number for palindromic behavior (reading the same backwards
> > and forwards). So if I have an integer 1457 it can tell me this is not
> > the same from both ends but 1551 is. I think the simplest way would be
> > to work inwards from both ends checking digits for equality, but I
> > don't know enough (yet) to do this.
> > All help is much appreciated.
> > Benjamin
> This problem (and the OP's previous problem) are probably homework
> problems.   If so, it was unethical for the student to ask for a
> solution here, and it was careless of several responders to provide a
> solution.   Let's not make the same mistake this time.
> Gary Herron

Could be.  Or, like me, they could be working the Project Euler
problems.  IIRC, many of the solutions involve checking for this type
of thing.  I'd like to see the OP's work before we give our solutions,


More information about the Python-list mailing list