Created
August 5, 2024 23:13
-
-
Save Wind010/02eb7e9f593690b2bc7d7ad65742c0cd to your computer and use it in GitHub Desktop.
Create permutations of a list of objects up to n selected combined elements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
n = 3 | |
names = [ | |
"Jordan", "Haig", "Emily", "Johns", "Elisa", "Maldonado", "Brandi", "Simmons", "Gerard", "Sekawa", "Shelly", "Buckle", "Alice", "Apple", "Maxis", "Stewart", "Olivia", "Johnson", "Ava", "Brown", "Sophia", "Taylor", "Amelia", "Davis", "Evelyn", "Rodriguez", "Emma", "Smith", "Charlotte", "Jones", "Mia", "Miller", "Harper", "Garcia", "Abigail", "Martinez" | |
] | |
permutations = [''.join(p) for p in itertools.product(names, repeat=n)] | |
[print(perm) for perm in permutations] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment