Python Program to Find Factorial of Number Using Recursion

preview_player
Показать описание
Hi,

In this video I tried to explain the Python Program to Find Factorial of Number Using Recursion

Python Scripts
======================

Python Functions Solved
==========================

Python Programs Solved
============================

Factorial of a number is product of numbers and the numbers below it.
For example seven factorial 7! = 7 * 6 * 5 * 4 * 3 * 2 * 1
zero factorial is 1 : 0! = 1
factorial of negative number is void - it cant be calculated

Recursion refers to function calling itself directly or indirectly.
Function a calling b and b calling a is indirect recursion.

Function a calling itself a is direct recursion.

Please like , share , comment if you liked this video. Thank you for watching.
Рекомендации по теме
Комментарии
Автор

Could you explain please why there is no else after the if condition? It only says return, without else

def fact(x):
if x == 0:
return 1
return x * fact(x - 1)

x = int(input('Enter 4: '))
print(fact(x))

liri
join shbcf.ru