This program is an example of:

def factorial(x):

if x == 1:

return x

else:

return x * factorial(x-1)

Group of answer choices

a do while loop.

recursion.

a for loop.

a while loop.

Respuesta :

The program is an example of recursion

In computer programming, recursion is a process in which a function calls itself.

In a recursive program, there is a

  • base case
  • and a recursive case.

When the condition of recursion is met, the base case is returned, else, the recursive case is continued.

In the function given above,

  • the base case is 'return x' under the condition 'if x == 1'.
  • The recursive case is 'return x * factorial(x - 1)'.

So, the function runs until the base case it met and then it stops.

So, the program is an example of recursion.

Learn more about recursion here:

https://brainly.com/question/25797503