It tells me that my function returns a wrong value, but it doesn't? What is going on here?
I get a "Oops, try again. factorial(1) returned 6 instead of 1" while you can see in the screenshot it returned a 1.
I tried it with other values. For example if you test my function with the value "4" it returns 24 which is correct but I'll get the error "Oops, try again. factorial(4) returned 48 instead of 24"
This should work right?
fact_list =  def factorial(x): calc = x fact = x while calc > 1: fact_list.append(calc) calc -= 1 else: for i in fact_list: fact = fact * (i - 1) return fact print factorial(1) print factorial(4)