This is under "Practice Makes Perfect", Number 5. "factorial"
Ok so I wrote the code below, and the module said that I completed the challenge and that I could move on to the next one, but it just printed "None" to the screen. So I obviously didn't do something right. Can someone help explain: A) why it told me I was right; and B) what I can adjust to have the function actually work?
Thank you in advance!
Link to the lesson: link
def factorial(x): if x == 0: return 1 elif x == 1: return 1 else: while x > 0: return x * factorial(x-1) x = x-1 return factorial(x) factorial(7)