Denis Kasak: > spam = ['a', 'n', 'n', 'a'] > eggs = spam[:] > if spam.reverse() == eggs: > print "Palindrome"
An alternative version: >>> txt = "anna" >>> txt == txt[::-1] True >>> txt = "annabella" >>> txt == txt[::-1] False Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list