Hii ,I was making a factorial program in python using recursion/ but I have one doubt : if I run the program I get the error as : " result=xfact(x-1) TypeError: unsupported operand type(s) for : 'int' and 'NoneType'"
But If I run it with the commented statements it works fine .So my question is in the else why my return statent doesn't work ?
def fact(x):
if x==1 or x==0:
y=1
else:
#result=x*fact(x-1)
#return result
y=x*fact(x-1)
return y
t=int(input())
for i in range(t):
n=int(input())
y=fact(n)
print(y)