Created
June 19, 2018 12:30
-
-
Save Fhernd/910b46b2d266415bcfcdad0c350d4d45 to your computer and use it in GitHub Desktop.
Generación de permutaciones y combinaciones de un conjunto de elementos. OrtizOL.
This file contains 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
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