[Tutor] How to find reverse pair words in a list of Words that has to be accessed through a URL

Alan Gauld alan.gauld at btinternet.com
Sat Apr 20 01:57:07 CEST 2013


On 19/04/13 23:16, emile wrote:

> The gotcha with this approach is the border case of self paired words
> that aren't pairs.  (pop,wow,mom,etc)

yeah, but those exceptions are easy to catch as you generate the 
reversed list:

if reversed(word) == word

And its a bit of a moot point whether you should
perhaps count a palindromic word as a pair of itself...


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list