Python Forum
counting items in a list of number combinations
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
counting items in a list of number combinations
#1
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


Messages In This Thread
counting items in a list of number combinations - by Dixon - Feb-19-2020, 06:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to parse and group hierarchical list items from an unindented string in Python? ann23fr 0 193 Mar-27-2024, 01:16 PM
Last Post: ann23fr
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,354 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Delete strings from a list to create a new only number list Dvdscot 8 1,547 May-01-2023, 09:06 PM
Last Post: deanhystad
  find random numbers that are = to the first 2 number of a list. Frankduc 23 3,249 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  Finding combinations of list of items (30 or so) LynnS 1 885 Jan-25-2023, 02:57 PM
Last Post: deanhystad
  For Word, Count in List (Counts.Items()) new_coder_231013 6 2,618 Jul-21-2022, 02:51 PM
Last Post: new_coder_231013
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,885 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  How to get list of exactly 10 items? Mark17 1 2,538 May-26-2022, 01:37 PM
Last Post: Mark17
  Split a number to list and list sum must be number sunny9495 5 2,305 Apr-28-2022, 09:32 AM
Last Post: Dexty
  how to assign items from a list to a dictionary CompleteNewb 3 1,592 Mar-19-2022, 01:25 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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