Write a python function to calculate nPr


Topic: Write a python function to calculate nPr

Solution

 def nPr(n, r):  
    
    def fact(n):  
        if (n <= 1): 
            return 1
        return n * fact(n - 1)
    return int(fact(n) /
                fact(n - r))
                



List all Python Programs