Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List/set
#5
I'm stuck here :
 
list = [{"a","b","c","d"},{"k","f","r","c"},{"c","a","o","r"},{"m","p","l"},{"i","r","p","b"}]
for i in range(len(list)):
    for j in range(i+1,len(list)): 
        if list[i] & list[j]:
            print(list[i]&list[j]) 
I don't understand how to find the most resemblance and how and print their indexs........ 
Reply


Messages In This Thread
List/set - by janek30 - Apr-25-2017, 08:56 AM
RE: List/set - by idontreallywolf - Apr-25-2017, 12:45 PM
RE: List/set - by janek30 - Apr-25-2017, 12:52 PM
RE: List/set - by buran - Apr-25-2017, 01:34 PM
RE: List/set - by janek30 - Apr-25-2017, 03:35 PM
RE: List/set - by buran - Apr-25-2017, 04:22 PM
RE: List/set - by janek30 - Apr-25-2017, 05:13 PM
RE: List/set - by buran - Apr-25-2017, 05:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020