#Jonathan Hudson #Student Number 12347890 #Date: 2020-08-26 #Lecture Practice # Compute n-factorial using recursion # Compute n-factor # Parameters: # n: The number for which the factorial is computed # Returns: n-factorial def factorial(n): # Display a message each time that the factorial function is called so that # we can see the recursive calls as they occur print("Computing", n, "factorial...") # Base case: 0! = 1 if n == 0: return 1 # Recursive case: n! = n * (n-1)! if n > 0: return n * factorial(n - 1) # Read an integer, a, from the user and display a-factorial a = int(input("Enter a non-negative integer: ")) print(a, "factorial is", factorial(a))