palindrome iteration

D'Arcy J.M. Cain darcy at druid.net
Fri Aug 27 12:02:39 EDT 2010


On Fri, 27 Aug 2010 11:49:42 -0400
"D'Arcy J.M. Cain" <darcy at druid.net> wrote:
> is_palindrome = lambda x: x == x.lower()[::-1]

Oops.  Simple and wrong.

is_palindrome = lambda x: x.lower() == x.lower()[::-1]

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list