Python Forum
Get 5 most unique combinations of elements in a 2D list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get 5 most unique combinations of elements in a 2D list
#2
look at itertools.combinations and note that there might be repeating followers among the 5 users (i.e. you need to use set in order to get unique followers). Then you need to find combinations with the largest number of unique followers
This is brute-force approach and it may take some time if the list is really long
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Get 5 most unique combinations of elements in a 2D list - by buran - Sep-24-2020, 02:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to sort a list with duplicates and return their unique indices. Echoroom 3 3,610 Sep-23-2022, 07:53 AM
Last Post: deanhystad
  help with adding duplicates elements together in a list 2ECC3O 5 2,132 Sep-10-2022, 07:11 AM
Last Post: 2ECC3O
  Unexpected behavior accessing list elements. tonyflute 2 2,306 Apr-09-2021, 02:36 PM
Last Post: tonyflute
  How to find difference between elements in a list? Using beginner Basics only. Anklebiter 8 4,440 Nov-19-2020, 07:43 PM
Last Post: Anklebiter
  Loop through elements of list and include as value in the dictionary Rupini 3 2,706 Jun-13-2020, 05:43 AM
Last Post: buran
  How can I print the number of unique elements in a list? AnOddGirl 5 3,342 Mar-24-2020, 05:47 AM
Last Post: AnOddGirl
  Extracting elements in a list to form a message using for loop Tony04 2 2,406 Oct-25-2019, 05:55 PM
Last Post: ichabod801
  Sum of elements on the list recursive sev 3 2,601 Jun-20-2019, 02:14 PM
Last Post: sev
  Combinations mnnewick 1 2,635 Dec-17-2018, 02:35 PM
Last Post: ichabod801
  reach the elements in the list ptah 7 5,144 Oct-04-2017, 08:12 PM
Last Post: ptah

Forum Jump:

User Panel Messages

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