##### counting items in a list of number combinations
 counting items in a list of number combinations Dixon Silly Frenchman Posts: 37 Threads: 14 Joined: Jan 2018 Reputation: Feb-19-2020, 06:08 PM import itertools numbers = [1,2,3,4,5,6,7,8,9,10] result = itertools.permutations(numbers,2) for item in result: print (item)Simple, I know, but escaping me me how to count the permutations of paired numbers in the list created. Reply michael1789 Minister of Silly Walks Posts: 419 Threads: 34 Joined: May 2019 Reputation: Feb-19-2020, 07:01 PM I'm sure this is super hacky, but: import itertools numbers = [1,2,3,4,5,6,7,8,9,10] result = itertools.permutations(numbers,2) total_permutations = 0 for item in result: total_permutations += 1 print(total_permutations) Reply Dixon Silly Frenchman Posts: 37 Threads: 14 Joined: Jan 2018 Reputation: Feb-19-2020, 07:06 PM (This post was last modified: Feb-19-2020, 07:06 PM by Dixon.) (Feb-19-2020, 07:01 PM)michael1789 Wrote: I'm sure this is super hacky, but: import itertools numbers = [1,2,3,4,5,6,7,8,9,10] result = itertools.permutations(numbers,2) total_permutations = 0 for item in result: total_permutations += 1 print(total_permutations) import itertools numbers = [1,2,3,4,5,6,7,8,9,10] result = itertools.permutations(numbers,2) count = 0 for item in result: print (item) count += 1 print (count)I just worked it out with the above. Thank you for the reply though. Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Feed List items with Integer euras 9 594 May-19-2021, 07:45 PM Last Post: snippsat Parse String between 2 Delimiters and add as single list items lastyle 5 619 Apr-11-2021, 11:03 PM Last Post: lastyle Sum of list items tristanfermat 2 529 Feb-06-2021, 12:04 PM Last Post: tristanfermat Counting number of words and organize for the bigger frequencies to the small ones. valeriorsneto 1 346 Feb-05-2021, 03:49 PM Last Post: perfringo All possible combinations CODEP 2 550 Dec-01-2020, 06:10 PM Last Post: deanhystad Counting Element in Multidimensional List quest_ 1 483 Nov-25-2020, 10:00 PM Last Post: quest_ Counting Number of Element in a smart way quest 2 489 Nov-09-2020, 10:24 PM Last Post: quest Triplet Combinations of All Values quest 2 548 Nov-05-2020, 09:22 AM Last Post: quest Count number of occurrences of list items in list of tuples t4keheart 1 582 Nov-03-2020, 05:37 AM Last Post: deanhystad How do I add a number to every item in a list? john316 2 441 Oct-28-2020, 05:29 PM Last Post: deanhystad

Forum Jump:

### User Panel Messages

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