Oops, try again. factorial(2) returned None, did you remember to return the result?
This answer below could not pass the exercise but have a correct answer, however, if i remove return ans, no answer showed but it passed. why does it happened?
def factorial(x): ans = 1 if x == 1 or x == 0: return 1 else : for n in range(1,x): ans = x*ans x = x-1 return ans print ans factorial(4)