Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 10:17 PM, Mike Nickey wrote: > On Fri, Jun 8, 2012 at 7:03 PM, Dave Angel wrote: >> On 06/08/2012 09:46 PM, Mike Nickey wrote: >>> Thanks guys, >>> This time you forgot to include the list in your posting. Easiest way is to do Reply-all. But you've done it right several times, so t

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 09:46 PM, Mike Nickey wrote: > Thanks guys, > You top-posted your comments, so we lose all context. Put your remarks after the part you're quoting. Or if the stuff you're quoting is irrelevant, strip it out, as I've done here. It's irrelevant because the order is wrong. > Those h

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Mike Nickey
Thanks guys, Those have helped. Now a new issue comes up. The list 'palindrome' is not being populated. I know that there is a few in the list. I think this is in the compareElements def. While I'm familiar with the .append() call I don't know why it's not populating the palindrome list. Thanks

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 09:01 PM, Marc Tompkins wrote: > On Fri, Jun 8, 2012 at 5:10 PM, Mike Nickey wrote: > >> def compareElements(wordList): >>for item in wordList(): >>if item == item.reversed(): >>print item >>else: >>next(item) >> >> > reversed() is not a st

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Marc Tompkins
On Fri, Jun 8, 2012 at 5:10 PM, Mike Nickey wrote: > def compareElements(wordList): >for item in wordList(): >if item == item.reversed(): >print item >else: >next(item) > > reversed() is not a string method. To reverse a string, try something like this

[Tutor] Finding palindromes in a list

2012-06-08 Thread Mike Nickey
I'm trying to write a bit of code that will run through a text file and find the item or word string that is the same forward as it is when it is revered...a palindrome. I'm having a bit of issue looping through the wordList[] that I have created. If you have any comments or suggestions I'd really