counting items in a list of number combinations - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: counting items in a list of number combinations (/thread-24560.html) counting items in a list of number combinations - Dixon - Feb-19-2020 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. RE: counting items in a list of number combinations - michael1789 - Feb-19-2020 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) RE: counting items in a list of number combinations - Dixon - Feb-19-2020 (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.