Question from the Python - Fundamentals test

Write a Python function that returns the factorial of a number.

Easy

Consider the following Python code. What will be the output of this code?

def func(n):
    if n == 0:
        return 1
    return n * func(n-1)

print(func(3))
Author: Vincent CotroStatus: PublishedQuestion passed 1082 times
Edit
25
Community Evaluations
developer avatar
Marc AUGIER
11/08/2024
C'est l'exemple incontournable de récursivité avec la fonction factorielle