The function nPr(n,r) is supposed to take two integers n and r ()…

Question Answered step-by-step The function nPr(n,r) is supposed to take two integers n and r ()… The function nPr(n,r) is supposed to take two integers n and r () and calculate the number of permutations of  items out of .The program as written does not work, even though the logic is correct. Find and fix any syntax errors/mistake(s) that prohibit the program from functioning as intended. Note that this program uses a functional programming approach.# range(n-r+1,n+1) produces the list [n-r+1, n-r+2, …, n]def nPr(n,r):      if n<0 or r<0 or n