I'm having troubles with the factorial exercise:
It calculates the factorial correctly (a 24 for x=4, a 120 for x=5, etc...) but then I get this error:
Oops, try again. factorial(1) resulted in an error: invalid literal for int() with base 10: ''
Any idea on why this keeps happening? Thanks in advance.
def factorial(x): x=int(raw_input("Number?")) #Number f=x #Factorial while x > 1: x=x-1 f=f*x print "The factorial is" , f return f factorial(x)