I am try to convet this function by creating it as a for or while loop, but having trouble.
def fact(n):
if n<= 1:
return 1
else:
return (n)*(fact(n-1))
this is what I attempted:
def fact(n):
while n <= 1:
return 1
else:
return (n)*(fact(n-1))