npr in python code example
Example: nPr python
import math
def fact(n):
if (n <= 1):
return 1
return n * fact(n - 1)
def nPr(n, r):
return math.floor(fact(n)/fact(n - r))
print(nPr(4,2))
import math
def fact(n):
if (n <= 1):
return 1
return n * fact(n - 1)
def nPr(n, r):
return math.floor(fact(n)/fact(n - r))
print(nPr(4,2))