Created
September 19, 2019 01:30
-
-
Save ychevarrias/06a74a68c31ce0a3e9119c97b79886d1 to your computer and use it in GitHub Desktop.
Combinaciones y permutaciones
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
prmt = lambda x, y: math.factorial(x)/math.factorial(x-y) | |
comb = lambda x, y: prmt(x, y)*(math.factorial(y)**-1) | |
# 6 personas en 4 lugares respetando sus posiciones dan 360 escenarios | |
assert prmt(6, 4) == 360 | |
# 6 personas en 4 lugares sin importar posiciones dan 15 escenarios | |
assert comb(6, 4) == 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment