[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 00:07:50 CEST 2013
On 19/04/13 22:19, Chetan Sai wrote:
> I'm a beginner in Python Programming.
The language isn't really the issue here the issue is the algorithm.
So how would you do it manually with a paper and pen? (forget about
fetching the list from the URL for now)
One possibility is to use sets (Python has a set data type).
create a set of words.
Now create a set of reversed words.
The intersection of those sets is the set of words which
also have a reversed pair.
print the intersection set.
just one way.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list