Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 19, 2018 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/910b46b2d266415bcfcdad0c350d4d45 to your computer and use it in GitHub Desktop.
Save Fhernd/910b46b2d266415bcfcdad0c350d4d45 to your computer and use it in GitHub Desktop.
Generación de permutaciones y combinaciones de un conjunto de elementos. OrtizOL.
from itertools import permutations, combinations
elementos = ['Python', 'PyCharm', 'Programming']
# Permutaciones:
print('Permutaciones:')
for p in permutations(elementos):
print(p)
# Combinaciones:
print('\nCombinaciones:')
for c in combinations(elementos, 2):
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment