On Jul 11, 6:20 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> > Try this:
>
> > spam = ['a', 'n', 'n', 'a']
> > eggs = spam[:]
> > if spam.reverse() == eggs:
> >     print "Palindrome"
>
> You could also do
>
> >>> spam = ['a','n','n','a']
> >>> if spam == [i for i in reversed(spam)]:
>
>         print "Palindrome"
>

Or instead of this:

    [ i for i in generator_expression]

just use the list constructor:

    list(generator_expression)

-- Paul
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to