Skip to content

Instantly share code, notes, and snippets.

@danieltomasz
Created January 4, 2026 20:08
Show Gist options
  • Select an option

  • Save danieltomasz/1942746d6b8f2ea931ff2068105ff3a6 to your computer and use it in GitHub Desktop.

Select an option

Save danieltomasz/1942746d6b8f2ea931ff2068105ff3a6 to your computer and use it in GitHub Desktop.
kombinacje bez powtorzen
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