It's Only Factorials

Do the following snippets of code always return the same output given a positive integer input?

1
2
3
4
5
def factorial(n):   
   factorial = 1   
   for number in range (1, n):   
      factorial = factorial * number   
   return factorial

1
2
3
4
5
def factorial(n):   
   if n == 1 :   
      return 1   
   else:   
      return n*factorial(n-1)   

×

Problem Loading...

Note Loading...

Set Loading...