Answer
Yes — this is the standard recursive definition of factorial.
Work Step by Step
The given code is correct. It returns 1 if 1 when N is 0, which is the base case and in other cases it returns N*(fact(N-1)) , on substituting the value of fact(N-1) we will get
$N*((N-1) * fact(N-2)) $
and if we keep on substituting until base case we will get
$N*(N-1)*(N-2)*...*3*2*1 $
which is the definition of N!. Hence the given code is correct.
Iterative version of the program-
def fact(N):
ans=1
while(N>0):
ans = ans * N
N-=1
return ans