Defining a Recursive Function

In this lesson, you’ll learn that all recursive functions have two parts:

  1. Recursive case
  2. Base case

You’ll also see how to define the factorial symbol recursively:

def factorial_recursive(n):
    if n <= 1:
        return 1
    return n * factorial_recursive(n - 1)

Comments & Discussion

kwf777 on Dec. 23, 2019

So now you’ve brought out the project manager in me. Explain why 7 resources instead of 1 to do the same job is economically feasible and makes good business sense?

James Uejio RP Team on Dec. 31, 2019

Hi kwf777,

Feel free to take a look at the last video in this course where I give some real world examples on why you would use recursion over other techniques.

JulianV on Jan. 31, 2020

Nice warm up!

Become a Member to join the conversation.