Created
January 4, 2026 20:08
-
-
Save danieltomasz/1942746d6b8f2ea931ff2068105ff3a6 to your computer and use it in GitHub Desktop.
kombinacje bez powtorzen
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 | |
| # Twoja lista znaków (1-6 oraz A-F) | |
| elementy = ['1', '2', '3', '4', '5', '6', 'A', 'B', 'C', 'D', 'E', 'F'] | |
| # Wybieramy pierwsze 6 elementów, aby uzyskać dokładnie 720 permutacji (6! = 720) | |
| # Jeśli chcesz inne 6 elementów, po prostu zmień listę powyżej | |
| wybrane_elementy = elementy[:6] | |
| # Generowanie permutacji | |
| permutacje = list(itertools.permutations(wybrane_elementy)) | |
| # Wyświetlanie wyników | |
| print(f"Wygenerowano {len(permutacje)} kombinacji dla elementów: {wybrane_elementy}\n") | |
| for i, p in enumerate(permutacje, 1): | |
| print(f"{i}. {''.join(p)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment