Find the nearest value of a list element

Viewed 671

I have two lists which are:

>>> list1 = ['gain','archive','win','success']
>>> list2 = ['i','win','game','i','am','success','cool']

and also I found the same values of both list by comparing the lists.

>>> result= set(list1) & set(list2)

Output is

set(['win', 'success'])

Now I want to find the next element value of the result. Here it would be: 'game' and 'cool'.

How can I do this (using python 2.7)?

5 Answers
Related