Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import factorial
- def combinatoria(n, k):
- return factorial(n) // factorial(k) * factorial(n - k)
- a = input("Digite el valor de a:")
- b = input("Digite el valor de b:")
- while (not (a.isdigit() and b.isdigit)):
- print("a y b deben ser valores numericos")
- a = input("Digite el valor de a:")
- b = input("Digite el valor de b:")
- if (a > b):
- print("a debe ser menor que b, por lo tanto a será ", b, "y b será ", a)
- temp = a
- a = b
- b = temp
- a = int(a)
- b = int(b)
- print(combinatoria(a, b))
Add Comment
Please, Sign In to add comment